How to Allow Remote MySQL Connections in cPanel
Introduction
By default, MySQL databases on cPanel hosting accounts only accept connections from the local server. If you need to connect to your database from an external server, application, or development environment, you must authorize the remote IP address using cPanel's Remote MySQL® feature.
This guide explains how to allow remote MySQL connections and the security considerations involved.
What Is Remote MySQL?
Remote MySQL allows external servers or applications to connect directly to a MySQL database hosted on your cPanel account.
Common uses include:
-
Connecting a website hosted on another server
-
Using a desktop database management application
-
Accessing a database from a development environment
-
Integrating third-party applications with your database
Before You Begin
You will need:
-
Access to your cPanel account
-
The IP address of the server or computer that will connect to the database
-
A MySQL database and database user already configured
If you have not yet created a database, please refer to our article on Creating a MySQL Database in cPanel.
Step 1: Log in to cPanel
Log in to your cPanel account using the credentials provided by your hosting provider.
Step 2: Open Remote MySQL®
In the Databases section of cPanel, click Remote MySQL®.
Depending on your cPanel version, the feature may be called Remote Database Access Hosts.
Step 3: Add an Access Host
Under the Add Access Host section:
-
Enter the IP address of the remote server or computer that will connect to the database.
-
Click Add Host.
Example:
192.168.1.100
After the host is added, it will appear in the list of authorized hosts.
You must submit a ticket to support asking us to white list the IP address.
Using Wildcards
You may use wildcard characters when necessary.
For example:
192.168.1.%
This allows all IP addresses beginning with:
192.168.1.
Important Security Note
Only use wildcards when absolutely necessary. Allowing large IP ranges increases security risks.
Whenever possible, authorize only the specific IP address that requires access.
Step 4: Verify Database User Permissions
Authorizing an IP address only allows the server to attempt a connection.
The database user must still have permission to access the database.
To verify permissions:
-
Open MySQL® Databases in cPanel.
-
Locate the database under Current Databases.
-
Confirm that the appropriate database user is assigned to the database.
-
Ensure the user has the required privileges.
For most applications, ALL PRIVILEGES are typically assigned.
Database Connection Information
When configuring a remote application, you will generally need:
Database Host
Your server hostname or IP address.
Examples:
server.example.com
or
192.0.2.10
Database Name
Example:
cpuser_database
Database Username
Example:
cpuser_dbuser
Database Password
The password assigned to the database user.
MySQL Port
The standard MySQL port is:
3306
Some hosting providers may use a different port.
Testing the Connection
After adding the remote host and configuring your application:
-
Save your connection settings.
-
Attempt to connect to the database.
-
Verify that the connection is successful.
If the connection fails, review the troubleshooting section below.
Troubleshooting
Access Denied for User
This usually indicates:
-
Incorrect username
-
Incorrect password
-
User not assigned to the database
-
Insufficient database privileges
Connection Timed Out
This may occur if:
-
The IP address was not added to Remote MySQL®
-
The IP address changed
-
A firewall is blocking the connection
-
The hosting provider restricts external MySQL access
Can't Connect to MySQL Server
Verify:
-
The hostname is correct
-
The server IP is correct
-
The MySQL port is correct
-
The remote host has been authorized
Dynamic IP Addresses
If your internet provider assigns dynamic IP addresses, your IP may change periodically.
When this happens, you may need to update the authorized IP address in cPanel.
Security Best Practices
When enabling remote MySQL access:
-
Only authorize IP addresses you trust.
-
Remove unused access hosts.
-
Avoid using broad wildcard entries.
-
Use strong database passwords.
-
Grant only the privileges required by the application.
-
Monitor your applications for unauthorized access attempts.
Removing Remote Access
If remote access is no longer required:
-
Open Remote MySQL® in cPanel.
-
Locate the authorized host.
-
Click Delete next to the entry.
-
Confirm the removal.
The remote server will no longer be able to connect to your database.
Conclusion
The Remote MySQL® feature in cPanel allows external servers and applications to connect to your MySQL databases securely. By authorizing only trusted IP addresses and following security best practices, you can safely provide remote database access while minimizing security risks.