How to enable remote MySQL connection on cPanel

Login to the cPanel server as the root user via SSH or Terminal

Check to see if the database process is listening publicly already. The following shows that the MySQL process is listening only on localhost (127.0.0.1) which will prevent remote connections:

ss -tunlp | grep -i "mysql\|maria\|3306"

tcp LISTEN 0 0 127.0.0.1:3306 *:* users:(("mysqld",1814,24))

If the database is listening only on localhost, edit the /etc/my.cnf file and add the following configuration under the [mysqld] section:

bind-address=*

NOTE: Be sure to remove any existing bind-address configurations.

Restart the server with the following command:

/scripts/restartsrv_mysql --restart

Verify that MySQL or MariaDB is now listening on * which means that it will bind to all IP addresses of the server, both public and private:

ss -tunlp | grep -i "mysql\|maria\|3306"

tcp LISTEN 0 0 *:3306 *:* users:(("mysqld",30016,12))

NOTE: You may also specify a particular IP address if you want, but the * option is generally perfectly fine to use.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to fix IP Missing issue on cPanel/WHM

We are here to help you with solving the problem of Missing IP Server in list accounts. The...

Domain names are not showing in WHM

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...

How to Start/Stop or Restart Apache server

Apache is the HTTP server that is freely available over the internet. It is a kind of software or...

How to install Attracta SEO Tools plugin

RequirementscPanel/WHM needs to be installed on your server. Step 1: SSH into your server and go...

How to Install CpCleaner in cPanel through SSH?

Installation Run the following shell commands as root via SSH: wget -O cpc-1.0.3.tar...