By default, cPanel does not allow remote MySQL connections, which is a good thing as long as you don't need to.
If you are using cPanel and want to allow a remote IP to access your MySQL databases, then you will need to whitelist that IP (Enable Remote MySQL Connections).
How to set up Remote Access to MySQL Server in cPanel
Log in to cPanel. First, let's log in to cPanel. You can do so by going to yourdomain.com/cpanel or yourdomain.com:2083.
Head to your cPanel dashboard and follow the steps below.
Go to Databases, and click the Remote MySQL icon shown below.
From that section you'll be able to define whichy IP address should be allowed to access your MySQL Databases.
Allow access to MySQL from a specific IP address
In the Host field, type in the IP address then click Add Host. Repeat this step for each IP address you want to whitelist.
Once you have added the IP address to Remote MySQL, you will be able to connect.
Allow access to MySQL from any IP address
To do this, you will need to add a wildcard (%) in the Host field. You can also use the wildcard for a specific IP range, like 192.168.1.%.