By default a cPanel database only accepts connections from the same server. To connect from your own computer or another server, you must authorise that IP address first.
Steps
- Find the IP address you will be connecting from. Searching for "what is my IP" in a browser will tell you.
- In cPanel, open Remote MySQL® under Databases.
- Enter the IP address in the Host field.
- Add a comment so you remember later what the entry is for.
- Click Add Host.
Connecting
Use your domain or the server hostname as the database host rather than localhost, with the same prefixed database name, username and password.
Important cautions
- Never enter
%as the host. That permits connections from every address on the internet and exposes your database to constant automated attack. - A home broadband IP usually changes. When your connection drops you will need to add the new address. This is normal, not a fault.
- Remove entries you no longer use. Old addresses eventually get reassigned to someone else.
A safer alternative
If you only need occasional access, use phpMyAdmin inside cPanel instead. It requires no remote access rule at all and leaves nothing exposed.