LochStudios  /  Help Centre  /  cPanel  /  Allow Remote MySQL Access

Allow Remote MySQL Access

Configure your MySQL database to accept connections from external applications or remote servers.

Updated

By default, MySQL databases can only be accessed locally. To connect from a remote application, script, or server, you need to explicitly allow remote connections and may need to configure firewall rules.

Steps

1. Log in to cPanel
- Visit your cPanel URL (your provider will give you the exact hostname)
- Enter your username and password

2. Set the remote access host
- From the Home page, go to DatabasesRemote MySQL
- Under "Add Access Host," enter the IP address or hostname that will connect to MySQL
- To allow any remote host, enter % (use with caution)
- Click Add Host
- Confirm the host appears in the "Access Hosts" list

3. Verify your database user has remote privileges
- Go to MySQL Databases
- Locate your database user in the "MySQL Users" list
- If the user was created after adding the access host, it should already have remote access
- If the user existed before, you may need to re-assign it to the database to update privileges

4. Find your MySQL connection details
- Return to Remote MySQL and note the "Hostname" for remote connections (often server.yourhost.com or your server IP)
- For your application, use:
- Host: the hostname from Remote MySQL (NOT localhost)
- Port: typically 3306 (standard MySQL port)
- Username: your database user
- Password: the password you set for that user
- Database: the full database name (including any prefix added by cPanel)

5. Test the connection (optional)
- From the remote server or application, attempt to connect using the credentials above
- If it fails, check the next section

Tips & Notes

  • Firewall: Your hosting provider's firewall must allow outbound connections on port 3306 (MySQL). Ask your provider if port 3306 is open for remote MySQL.
  • IP vs. wildcard: If you know the exact IP of the connecting server, specify it instead of % for better security. You can add multiple access hosts for different servers.
  • Dynamic IPs: If your remote server has a dynamic (changing) IP address, you may need to add the new IP after each change, or ask your provider if they can allow a broader range.
  • Application setup: WordPress, custom scripts, and other apps usually have a "Database Configuration" step during installation—use the remote hostname and credentials here.
  • Troubleshooting: If a remote connection fails, confirm: (1) the access host is added, (2) the IP in the access host matches your connecting server, (3) port 3306 is not blocked by your firewall, and (4) you're using the correct username and password.

Was this article helpful?

← Back to cPanel