How to Allow Remote Connection to MySQL Server in cPanel/WHM Server?

To prevent potential security risks to MySQL server, by default remote MySQL connections are disabled in cPanel servers. Remote MySQL connections can be allowed either through Web Host Manager (WHM) or through cPanel (for specific databases created under that cPanel account). Since we do not allow remote MySQL connections in cPanel shared hosting, this guide will be only applicable to our VPS and dedicated server customers. Before you check out following methods, make sure that port 3306 is opened in your server firewall.


Enable Remote MySQL from WHM

  1. Login to WHM.
  2. Locate SQL Services section and click on Additional MySQL Access Hosts link.

    MySQL Access Host

  3. At next screen, enter IP address or host(s) that you wish to grant remote MySQL access to and click the Save button. If you want to activate these settings for all cPanel accounts, click on Click Here link at bottom. Now, remote connection has been activated in WHM. Each cPanel account that wants to use remote connection need to activate it as follows.


Enable Remote MySQL from cPanel

  1. Login to cPanel.
  2. Locate the Databases section. Under Databases section locate Remote MySQL option and and click on it.

    Remote MySQL

  3. In the next screen, enter the hostname or IP address that you want to grant remote MySQL access to and click the Save button. If your IP address changes regularly, you can use wildcard by using the % symbol. This will add all IP addresses in that range. For example; if you want to list IP addresses range from 192.168.3.1 to 192.168.3.255, you can add an IP address as 192.168.3.%.

    Remote Database Access Hosts

NOTE: Following steps are additional and need to be taken only when you are unable to connect to MySQL server after enabling Remote MySQL from WHM.
Sometimes, after enabing MySQL remote connections, it could not get accessed remotely because it might bound on localhost (127.0.0.1). To fix this, you'll need to do following changes in MySQL configuration file (my.conf).

  1. Login to MySQL server (where MySQL server is installed) and edit the my.cnf file using a text editor such as vi. Usually my.cnf file is located at /etc/mysql/my.cnf or at /etc/my.cnf.

    # vi /etc/my.cnf
  2. Once file is opened, locate line that containts skip-networking and make sure that it is commented as follows.

    # skip-networking
  3. Now locate the line containing bind-address and comment it out as follows.

    # bind-address = 127.0.0.1
  4. Save and Close the file and Restart the MySQL server.

    # /etc/init.d/mysql restart   //    Debian & Ubuntu Linux
    # /etc/init.d/mysqld restart // CentOS & Fedora Linux

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to redirect cPanel/Webmail to encrypted connection [SSL]?

When you want to transmit sensitive information over the Internet, you should use HTTPS instead...

Fix - tailwatchd service is down in WHM

One of our customers received an email from WHM that service tailwatchd is down. We have taken...

Fix - cPanel Account Restore Failed: Failed to create the account. A database owner with the name “cpaneluser” already exists

One of our customers was migrated from another cPanel host. While restoring his account to our...

Fix :: file open /home/user/etc/domainname/passwd failed with error no such file or directory

Problem Statement Getting error while creating an email account from cPanel. Error Message...

How to Set the Server Time Zone in WHM?

We deliver Linux VPS with default Timezone i.e. MST – Mountain Standard Time. You may need to...