In CSF, there is an option to allow IP address in a file which is ‘csf.allow’ that allows connections from external. Please do follow the steps here for enabling remote MySQL for an IP address on a cPanel server.
Either you can white-list the IP address that you need to connect to the server or you can enable only a port for the specified IP address.
Step I : Enable the port 3306 only for the specific IP address:
This can be done in the CSF configuration file ‘/etc/csf/csf.allow‘
# vi /etc/csf/csf.allow --- tcp:in:d=3306=x.x.x.x ---
where x.x.x.x is your IP address
[[email protected] ~]# cat /etc/csf/csf.allow| grep 3306 tcp:in:d=3306=18.104.22.168
White-list the IP address in the CSF
#csf -a x.x.x.x
Step II : Restart CSF
Step III : Add the IP address in remote MySQL in cPanel
a) Navigate to Databases section in cPanel b) Click on Remote MySQL c) Add the IP address that you need to add in "Access Hosts"