Articles in this section

Remote connection to a database hosted on Plesk fails: ERROR 2003 (HY000): Can't connect to MySQL server

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • Remote connection to MySQL/MariaDB database hosted on Plesk fails with the error:

    # ERROR 2003 (HY000): Can't connect to MySQL server on '<Plesk server Ip Address>'

  • The option Allow local MySQL server to accept external connections is enabled in Plesk > Tools & Settings > Database Servers > click MySQL (MariaDB).

Cause

MySQL/MariaDB misconfiguration. There is another configuration file at /etc/mysql/ folder where the localhost address is set at the bind-address parameter of the MySQL server configuration MySQL service.

Resolution

  1. Connect to the server via SSH.

  2. Find the config file where bind-address is set to the 127.0.0.1

    # grep -R 'bind-address' /etc/mysql/* /etc/my.cnf
    /etc/mysql/mariadb.conf.d/example.cnf:bind-address = 127.0.0.1

  3. Comment or remove the line at the configuration file where the bind-address parameter is set to the localhost address(or remove this line completely), it should look like below:

    # grep bind-address /etc/mysql/mariadb.conf.d/example.cnf
    #bind-address = 127.0.0.1

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.