Change MySQL port number for security purpose | |||
| |||
The default port that MySQL database server is running under Linux and Unix is 3306/TCP. In order to change the default MySQL/MariaDB database port in Linux, open MySQL server configuration file for editing by issuing the below command.
Search for the line stat starts with [mysqld] and place the following port directive under [mysqld] statement, as shown in the below file excerpts. Replace the port variable accordingly
After you’ve added the new MySQL/MariaDB port, save and close the configuration file.
If you use SELinux, you should install the following package under CentOS 7 in order to apply the required SELinux rules to allow the database to bind on the new port.
Next, add the below SELinux rule to bind MySQL socket on the new port and restart the database daemon to apply changes, by issuing the following commands. Again, replace MySQL port variable to match your own port number. On CentOS/RHEL
On Debian/Ubuntu
Tags: CentOS7 MySQL MySQL Port | |||
| |||
| |||
Login for comment |
SIMILAR POSTS Check network port is open or not on CentOS 7 |
OTHER POSTS IN THE SAME CATEGORY Network diagnostic tool for IPv4/IPv6 - traceroute/traceroute6 |