By default, your MySQL databases can only be accessed locally by using the hostname localhost.
If you would like to connect to your database remotely from your home or office you need to enable external access through cPanel.
To get started, login to your cPanel and click the Remote MySQL icon found under the Databases section.
Next, In the Add Access Host section, enter the domain name or IP address that you wish to add in the Host field (A). The Comment field (B) is optional and is used to distinguish the host you’re adding. You can leave it blank or put something like ‘office’ for example.
Click Add Host (C) to complete the setup. You can now connect to your databases remotely.