一、查看默认端口号
登录mysql
mysql -uroot -p
使用show global variables like 'port'; 命令查看端口号,
mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.00 sec)
二、mysql端口号的修改
编辑/etc/my.cnf文件
vi /etc/my.cnf
添加port=3307
重启mysql
/etc/init.d/mysqld restart