1.登录mysql
mysql -u root -p
2.查看当前端口号
show global variables like 'port';
3.修改端口
vim /etc/my.cnf
4. 增加或修改端口参数,然后保存退出
port=3308
5.重启mysql
service mysqld restart
6.查看mysql状态
systemctl status mysqld
mysql -u root -p
show global variables like 'port';
vim /etc/my.cnf
port=3308
service mysqld restart
systemctl status mysqld