How to Remotely Connect to a MySQL Database
Remote database connection permits MySQL databases hosted on your account to be accessed by servers located remotely. This feature in cPanel comes in handy when you want other servers to be able to access your databases.
- Configuration Settings
- Remote MySQL Connection
- Remove Remote Access Host
- Database Management
Remote MySQL Database Connection in cPanel
Use the following configuration settings for connecting to your database:
- Host name - (use the server IP address)
- Database name - (cpanelUsername_databaseName)
- Database username - (cpanelUsername_databaseUsername)
- Database password - (the password you entered for that database user)
- MySQL Connection Port - 3306
- TCP or UDP - either is fine
To enable remote MySQL connection, the connecting computer must be added as an Access Host. Follow these steps:
- Log into cPanel and click the Remote MySQL icon under Databases.
- Type in the connecting IP address under Host and click the Add Host button.
You should now be able to connect remotely to your database.
To remove a host from accessing databases on your server:
- Under Manage Access Hosts, click the trash icon next to the IP address you want to remove.
- If you are sure you wish to prevent the server from accessing your databases, click Remove Access Host.
Note: Having a dynamic IP address means that the connecting IP address can change periodically depending on the Internet Service Provider (ISP). You must update the connecting IP in Remote MySQL every time it changes.
After whitelisting the IP to allow remote connection, you should be able to make the proper remote MySQL connection with the database's name and user found on cPanel's MySQL Databases page. The most common problem in connecting is due to an incorrect username and/or password. Please ensure the username you use matches the username created in the "MySQL Database" section of your cPanel. For examples of MySQL errors, please see the related article: MySQL Errors.
You will need a third-party application to access MySQL remotely. Some are free, and some cost money.
To ensure easy access to your MySQL databases, you can set up a remote database connection on your account. This guide outlines all the necessary configuration settings that you may need. Additionally, you can find helpful tips for troubleshooting any common connection problems by visiting the articles linked.
If you haven't created your databases, you can read our easy guide on creating and deleting MySQL. We'll help you get started right away.