To improve the security of the server, this lesson is mainly about how to modify the MySQL port under Linux. Support for most system changes in Linux environments, such as CentOS and Ubuntu.
Demo Environment:
Linux CentOS 6.3 X32
Mysql 5.1.66
First, edit my.conf
Vi/etc/my.conf
Second, add port=3506 under [mysqld]
Third, restart the MySQL service
#/etc/init.d/mysqld restart
Tips:
0, 3506 is the port you want to modify;
1. Remember to add the port into the iptables after the modification;
2, updated MySQL port, may have been the site will not be able to connect, remember in the Web site configuration file plus port;
3. If the service cannot be restarted after modification, please check
A, the use of the port will not be occupied?
B, edit/etc/my.conf add [client] port=3506
C, add and then restart the MySQL service
Tips , if you modify the MySQL port, we must be in the program connected to the place you modify the port, some friends do not use the port 3306 connection, but the change must be taken, do not change with the port MySQL default 3306.