...
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.
Code Block |
---|
|
# yum install policycoreutils-python |
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
Code Block |
---|
|
# semanage port -a -t mysqld_port_t -p tcp 12345
# systemctl restart mariadb |
On Debian/Ubuntu
Code Block |
---|
|
# systemctl restart mysql |
In order to verify if the port configuration for MySQL/MariaDB database server has been successfully applied, issue netstat or ss command and filter the results via grep command in order to easily identify the new MySQL port.
Code Block |
---|
|
# ss -tlpn | grep mysql
# netstat -tlpn | grep mysql |
...