Plesk

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

Symptoms

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

Exit mobile version