WebGee Docsالتوثيق
Databases

Allow remote MySQL connections

Grant an external IP address access to your cPanel MySQL databases, and what to do when the connection is still refused.

Allow a machine outside your hosting account — a local development environment, a reporting tool, a separate application server — to connect to your MySQL databases. Applies to shared and reseller hosting.

Remote MySQL is disabled by default because an openly reachable database is one of the most commonly attacked services on the internet. You are opening it to specific addresses only.

Never add % as an access host. That grants every address on the internet permission to attempt a login against your database.

Before you begin

You need the public IP address of the machine that will connect. On that machine, visit any "what is my IP" service, or run:

curl -s https://ifconfig.me

If your connection uses a dynamic IP, it will change — you will need to update this list when it does.

Grant access

  1. In cPanel, open Remote MySQL under Databases.
  2. In Add Access Host, enter the IP address.
  3. Select Add Host.

To revoke access later, select Delete beside the entry.

Connect

Use your domain as the host, and your existing cPanel database credentials:

mysql -h example.com -u cpaneluser_dbuser -p cpaneluser_dbname

The username and database name both carry your cPanel username as a prefix. You can see the exact values under cPanel → MySQL Databases.

Check it worked

From the machine you granted access to:

mysql -h example.com -u cpaneluser_dbuser -p -e "SELECT 1;"

A 1 back means the connection, the credentials and the grant are all correct.

If the connection is still refused

Work through these in order — they cover nearly every case:

  • Your IP address changed. Most home and office connections have dynamic addresses. Re-check your current IP and add it.
  • The database user has no privileges on that database. Adding an access host does not grant a user access to a database. Check cPanel → MySQL Databases → Add User To Database.
  • Port 3306 is blocked at your end. Many corporate networks and some ISPs block outbound MySQL. Test with nc -vz example.com 3306.
  • WebGee is blocking it upstream. We block inbound MySQL at the network edge when we see attacks against mysqld. If everything above checks out, open a ticket and ask for your IP to be added to the allow list.

On this page