By default, MySQL databases on cPanel are only accessible from the same server (localhost). If you need to connect to your database from an external application, script, or desktop tool on a different server, you must configure Remote MySQL access. This guide explains how it works and how to set it up.

What Is the MySQL Host?

The MySQL host is the server address that applications use to connect to your database:

  • localhost — The database is on the same server as your website. This is the default for most cPanel applications (WordPress, Joomla, etc.).
  • Remote host — The database is accessed from a different server. You must add the connecting server IP address to the allowed hosts list.

Enabling Remote MySQL Access

  1. Log in to your cPanel account.
  2. Scroll to the Databases section and click Remote MySQL.
  3. Under Add Access Host, enter the IP address or hostname of the server that needs to connect.
  4. You can use wildcards to allow a range of IPs:
    • 192.168.1.% — Allows any IP starting with 192.168.1.
    • % — Allows connections from any IP address (not recommended for security reasons).
  5. Click Add Host.

Finding Your Database Connection Details

  • Database Host: localhost for local connections, or your server IP for remote connections.
  • Database Name: Found in MySQL Databases (includes the cPanel prefix, e.g., username_dbname).
  • Database User: Found in MySQL DatabasesCurrent Users (includes the cPanel prefix).
  • Database Password: The password you set when creating the user. If forgotten, you can change it under MySQL Databases.
  • Port: 3306 (default MySQL port).

When Do You Need Remote MySQL Access?

  • Connecting to your database from a desktop application (e.g., MySQL Workbench, DBeaver, Navicat).
  • Allowing an external server or application to read/write to your database.
  • Setting up a separate application server that needs database access.
  • Migrating data between servers using database management tools.

Important Notes

  • Some hosting providers disable Remote MySQL for security reasons. If the option is not available, contact your hosting provider.
  • Do not use % (allow all IPs) unless absolutely necessary. Always specify the exact IP address for security.
  • Remote connections may be slower than local (localhost) connections due to network latency.
  • Firewall rules on the server must allow inbound connections on port 3306 for remote MySQL to work.

Troubleshooting

"Access denied for user" when connecting remotely:

  • Verify the remote IP address has been added in Remote MySQL.
  • Double-check the database username and password.
  • Ensure the user has been assigned to the database with appropriate privileges.

"Connection timed out" when connecting remotely:

  • The server firewall may be blocking port 3306. Contact your hosting provider to check.
  • Verify the host IP address is correct.

Cannot find "Remote MySQL" in cPanel:

  • Your hosting provider may have disabled this feature. Contact support.
Was this answer helpful? 0 Users Found This Useful (0 Votes)