1. 登录到mysql查看当前的端口号:
show global variables like ‘port’;
2.编辑/etc/my.conf 文件添加port=3506 这样的样式 保存退出;
内容:
mysqld]
port=3506
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
3. 重启mysqld即可;