By default, remote MySQL connections are disabled for all cPanel servers. The server hosted with large websites faces a big issue that because MySQL consumes large amount of resources. This will lead to high server load and always slow down the server. So, the best option is to setup a remote MySQL connection. It will randomly reduce the MySQL resource usage. We can enable this feature in WHM. To enable remote MySQL connection in WHM, please follow the below given steps.
Steps to enable MySQL connection
1) Login to WHM server.
2) Navigate to the option ‘Additional MySQL Access Hosts’ under ‘SQL Services’ section.
3) Enter IP or host name from where you want to connect MySQL server remotely in the text box.
4) Click on ‘Save’ button to make the changes.
5) You can enable remote MySQL connection for all cPanel users by using the ‘Click here’ option.
Allow remote host IP in server firewall
1) Login to your server using SSH.
2) Whitelist the remote IP in the csf firewall by using the following command.
# csf -a <IP>
3) Restart the csf to enable the changes.
# csf -r
From WHM using the below steps:
1) Login to WHM.
2) Navigate to the option ‘ConfigServer Security & Firewall’ under the section ‘Plugins’.
3) To white list IP address in csf.allow file you must enter the IP that you want to white list in ‘Quick Allow’ section along with the option comment for allow.
4) Click ‘Quick Allow’ button to save changes.
You can also enable MySQL remote connections from cPanel
1) Login to your cPanel interface.
2) Navigate to the icon ‘Remote MySQL’ under ‘Databases’ section.
3) Add the remote host name or IP address in the text box.
4) Click ‘Add Host’ button to add the IP into the remote host list.
Now you can login to remote MySQL server from the allowed host in the WHM server.