UnderHost
Knowledgebase Docs

Remote MySQL in cPanel: external connections

Use cPanel Remote MySQL to whitelist trusted IP addresses, connect from external applications, and avoid exposing databases with wildcard access.

On this page

By default, cPanel MySQL databases are intended to be used by scripts on the same hosting account. Remote MySQL allows a trusted external server, application, or development IP to connect after you explicitly whitelist it.

When remote MySQL is needed

  • An external application server needs to read or write to a cPanel database.
  • A developer needs temporary database access from a fixed office or VPN IP.
  • A reporting tool or utility connects from another server.

If the website and database are on the same cPanel account, use localhost instead of Remote MySQL.

Whitelist an IP address

  1. Log in to cPanel.
  2. Open Databases and choose Remote MySQL.
  3. Enter the trusted remote IP address.
  4. Click Add Host.

Use the public IP address of the remote server or network. A local/private address such as 192.168.x.x will not work for internet connections.

Connection settings

SettingValue
HostYour server hostname or server IP.
Port3306 unless support has provided a different port.
DatabaseThe full cPanel-prefixed database name, such as cpuser_app.
UserThe full cPanel-prefixed database user, such as cpuser_appuser.
PasswordThe database user's password, not your cPanel password.
mysql -h server.example.com -P 3306 -u cpuser_appuser -p cpuser_app

Security guidance

  • Whitelist only specific trusted IP addresses.
  • Avoid % wildcard access on production databases.
  • Create a database user with only the privileges the remote app needs.
  • Remove temporary IPs when the test, or developer task is finished.
  • Do not share your cPanel password for database access.

Troubleshooting

ProblemWhat to check
Access deniedConfirm database username, password, database privileges, and cPanel prefix.
Connection times outConfirm the remote public IP is whitelisted and port 3306 is not blocked by the remote network.
Works locally but not remotelyLocal scripts should usually use localhost; remote access requires the external host IP.
Dynamic IP keeps changingUse a VPN/static IP or connect from a fixed server instead of repeatedly broadening the whitelist.

Related: Creating and managing MySQL databases in cPanel | Using phpMyAdmin in cPanel-import, export, and manage databases | How to secure your website | Error establishing a database connection-diagnosis and fix

Was this article helpful?

Need cPanel hosting or licensing?

Use UnderHost cPanel hosting or add cPanel/WHM to a VPS or dedicated server for familiar website, email, DNS, and database management.

Related articles

Back to cPanel