Skip to main content

Enabling Remote MySQL Access

databases, mysql, remote, access 0 Was this answer helpful?

By default, MySQL databases on your hosting server only accept connections from the local server (localhost). If you need to connect to your database from another server, a desktop application, or a cloud service, you'll need to whitelist the remote IP address.

Please note: Screens and options may vary slightly depending on your cPanel version and hosting plan.

⚠️ Caution: Incorrect changes here can make your website inaccessible. If you are unsure about any step, please contact our support team before proceeding.

Adding a Remote MySQL Host

  1. Log in to your cPanel account.
  2. In the Databases section, click Remote MySQL.
  3. In the Host field, enter the IP address that needs access.

- Enter a specific IP (e.g. 203.0.113.50) for a single server. - Use the % wildcard to allow a range (e.g. 203.0.113.% allows all IPs from 203.0.113.0 to 203.0.113.255).

  1. Click Add Host.

Connecting Remotely

Use these connection details in your remote application or script:

| Setting | Value | |---------|-------| | Host | Your server's IP address or hostname | | Port | 3306 (default MySQL port) | | Database | Your database name (with cPanel prefix) | | Username | Your database username (with cPanel prefix) | | Password | Your database user's password |

Security Considerations

  • Never use % as the host (allowing all IPs) unless absolutely necessary and only temporarily. This opens your database to the entire internet.
  • Only whitelist the specific IP addresses that need access.
  • Ensure the database user has only the minimum privileges required.
  • Use SSL/TLS connections when connecting remotely to encrypt data in transit.
  • Remove remote access entries when they're no longer needed.

Removing a Remote Host

On the Remote MySQL page, click Delete next to the host entry you want to remove.

Troubleshooting

  • "Access denied" — Check that the IP address is correctly whitelisted, and that the username and password are correct.
  • "Can't connect to MySQL server" — Verify the server hostname/IP, check that port 3306 is open on the server's firewall, and ensure your local network allows outbound connections on port 3306.

What Next?

Related Articles

knowledgebasedidyoufindanswer