In order to improve the security of the server, this lesson is mainly about how to modify the MySQL port under Linux. Support most system modifications in Linux environment, such as CentOS and Ubuntu.
First, the editor my.cnf
Vi/etc/my.cnf
Second, add the port=3506 under [mysqld]
Third, restart the MySQL service
Service mysqld Restart
Here I have a problem before, after modifying the port causes the MySQL to not be possible to troubleshoot the following
This is the log of startup failures that have been picked in/var/log/mysqld.log after the port is changed:
130823 17:21:14 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql
130823 17:21:14 [Warning] '--def Ault-character-set ' is deprecated and would be removed in a future release. Please use '--character-set-server ' instead.
130823 17:21:14 innodb:initializing buffer pool, size = 8.0M
130823 17:21:14 innodb:completed Initial ization of buffer pool
130823 17:21:14 innodb:started; log sequence number 0 44233
130823 17:21:14 [ERROR] Ca N ' t start server:bind on TCP/IP port:permission denied
130823 17:21:14 [ERROR] Do you already has another mysqld Ser Ver running on port:8060?
130823 17:21:14 [ERROR] aborting
130823 17:21:14 innodb:starting shutdown ...
130823 17:21:19 Innodb:shutdown completed; Log sequence number 0 44233
130823 17:21:19 [Note]/usr/libexec/mysqld:shutdown complete
Resolved as follows:
1. Firewall issues
Vi/etc/sysconfig/iptables
Add the following line:
-A input-m state--state new-m tcp-p TCP--dport 8060-j ACCEPT
2. SELinux issues
Method One: Do not need to restart Linux:
[Email protected] ~]# Setenforce 0
Method Two: Need to restart Linux:
Vi/etc/selinux/config
Selinux=disabled
Hint, if you change the MySQL port, we must be in the program connection where you change the port, some friends are accustomed not to use the port 3306 connection, but changed it must be brought, do not change the port MySQL default 3306.
This article from "12666595" blog, declined reprint!
Modify the MySQL port and the problems that occur