Introduction
The Remote MySQL icon in cPanel allows you to configure access to MySQL from IP addresses or hostnames.
Configuring access for an IP address is fairly straight forward, although it is not quite as apparent how hostname authentication works with MySQL.
By default, MySQL uses the PTR record of an IP address as the hostname to check against. The MySQL documentation also outlines a way to use SRV records instead, but that is outside the scope of this guide.
So if you are connecting from an IP address of 208.74.121.68, you would find the hostname to add to the Remote MySQL icon in cPanel by checking the PTR record of that IP address.
You can check PTR records with the dig utility and the -x flag like this:
dig +short -x 208.74.121.68
mx1.cpanel.net.
Or you can use an online utility such as the following:
https://www.whatsmydns.net/#PTR/208.74.121.68
The hostname that you would add to the Remote MySQL icon in this case would be mx1.cpanel.net.
There is another consideration to keep in mind. If the hostname provided by the PTR check does not have an A record that points back to the IP address that you're connecting from, MySQL would not be able to trust that the IP address matches the hostname and cannot allow access.
You can check the A record of a hostname like this:
dig +short mx1.cpanel.net
208.74.121.68
https://www.whatsmydns.net/#A/mx1.cpanel.net
If the A record is missing, you'll run into the issue described in the following article:
Host name example.com could not be resolved: Name or service not known - MySQL Error Log
In order to fix that you must contact the owner of the IP address and have them fix the PTR record and the A record of the corresponding hostname. If you're not sure who the owner of the IP address is check the following resource: