To allow remote MySQL access, you need to add your external IP address or domain to the Remote MySQL whitelist in cPanel. By default, MySQL databases are only accessible locally using localhost, but you can enable remote connections by adding authorized hosts through the Remote MySQL feature, allowing you to connect from your home, office, or other locations.
Why Remote MySQL Access is Disabled by Default
MySQL databases at OBHost and most hosting providers are configured to accept connections only from localhost for security reasons. This prevents unauthorized access attempts from external sources. When you need to connect to your database from a desktop application, remote server, or development environment, you must explicitly authorize those connection sources.
Step-by-Step Guide to Enable Remote MySQL Access
Step 1: Log Into cPanel
Access your cPanel account using the credentials provided when you signed up for hosting. Once logged in, locate the Databases section on your cPanel dashboard.
Step 2: Open Remote MySQL Tool
Click the Remote MySQL icon in the Databases section. This tool manages which IP addresses and domains are allowed to connect to your MySQL databases remotely.
Step 3: Add Your Access Host
In the Add Access Host section, you'll see two fields:
- Host: Enter the IP address or domain name you want to authorize. To find your current IP address, search "what is my IP" in any search engine.
- Comment: This optional field helps you identify the host later. You might enter "Office Computer" or "Home Network" for reference.
After entering your information, click Add Host to save the configuration.
Step 4: Verify the Host Was Added
Once added, your authorized host will appear in the Access Hosts list below. You can remove access at any time by clicking the delete icon next to any listed host.
Using Wildcards for Dynamic IP Addresses
If your IP address changes frequently, you can use the wildcard symbol % to authorize a range of addresses. For example, 203.0.113.% would allow any IP address starting with 203.0.113. However, use wildcards carefully as they reduce security. For maximum protection, use specific IP addresses whenever possible.
Important Security Considerations
When enabling remote MySQL access, keep these security practices in mind:
- Only add IP addresses you control and trust
- Use strong, unique passwords for your MySQL database users
- Remove access hosts you no longer need
- Avoid using wildcards unless absolutely necessary
- Consider using SSL/TLS encryption for database connections when possible
Troubleshooting Remote MySQL Connection Issues
If you're unable to connect after adding your host, check the following:
- Verify you added the correct IP address (your IP may have changed)
- Ensure your database username has proper permissions
- Check that you're using the correct MySQL hostname (typically your domain or server name)
- Confirm your firewall isn't blocking outbound connections on port 3306
- Verify the MySQL service is running on your hosting account
Frequently Asked Questions
What IP address should I add for remote MySQL access?
Add the public IP address of the computer or server that will connect to your database. You can find your current IP by searching "what is my IP" online. If connecting from a business network, ask your IT administrator for the network's public IP address.
Can I allow access from anywhere to my MySQL database?
While you can add % as a wildcard to allow connections from any IP address, this is strongly discouraged for security reasons. Only authorized specific IP addresses to minimize the risk of unauthorized access attempts.
Why does my remote MySQL connection stop working after some time?
This usually happens when your IP address changes. Many home and mobile internet connections use dynamic IP addresses that change periodically. You'll need to update the authorized host with your new IP address in the Remote MySQL tool whenever this occurs.
What port does MySQL use for remote connections?
MySQL typically uses port 3306 for remote connections. Ensure your local firewall and network allow outbound connections on this port. Some hosting configurations may use a different port, which will be specified in your hosting account details.
If you need assistance configuring remote MySQL access or encounter any issues, our support team is available 24/7 to help. Contact us at https://www.obhost.net/contact or email support@obhost.org for expert assistance.