MySQL修改默认端口号

1. 登录mysql

[root@localhost /]# mysql -u root -p

2. 查看端口号

mysql> show global variables like 'port';

3. 修改端口,编辑/etc/my.cnf文件

root@localhost etc]# vi my.cnf
[mysqld]
port=3506
~~~

4. 重新启动mysql

[root@localhost ~]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]

5.再次登录后检查端口已修改为’3506’.

root@localhost etc]# mysql -u root -p
mysql> show global variables like 'port';

你可能感兴趣的:(MySQL修改默认端口号)