Skip to main content
By default, applications hosted with us connect to MySQL on the same server using localhost. But sometimes you need the reverse — an application running elsewhere (your local machine, another server, a reporting tool) connecting to a database hosted on your cPanel account. That’s remote MySQL.

Step 1: Allow the remote host in cPanel

  1. Log in to cPanel.
  2. In the Databases section, click Remote MySQL.
image
  1. In the Add Access Host field, enter the IP address of the machine that will connect.
    • You can use the % wildcard (for example, 203.0.113.%) to allow a range.
    • To find your current IP, visit http://ipfinder.us.
  2. Click Add Host.
Avoid adding % (all hosts) on its own. That allows connection attempts from anywhere on the internet, and your database security then rests entirely on the password.

Step 2: Connect from the remote application

Use these connection details: Example from the MySQL command line:
Example from PHP:

Troubleshooting

  • Connection refused / timeout: the remote host’s IP isn’t in the allowed list, or a firewall between you and the server blocks port 3306. Double-check the IP you added — if you’re on a dynamic connection, your IP may have changed.
  • Access denied: the username/password is wrong, or the database user isn’t assigned to the database in cPanel (MySQL DatabasesAdd User To Database).
  • Works locally but not remotely: make sure you’re using the full prefixed username (cpuser_dbuser), not just dbuser.
For security and latency reasons, keep the application and database on the same server where possible. Use remote MySQL for management tools, reporting, and integrations rather than as the primary application connection.