Plesk

The error in Plesk: ERR [panel] SQLSTATE[HY000] [2002] No such file or directory, Can’t connect to local MySQL server through socket

Symptoms

Cause

The sockets specified in the files /etc/psa/psa.conf and /usr/local/psa/admin/conf/php.ini differ from the actual MySQL/MariaDB socket defined in the file /etc/my.cnf (/etc/mysql/my.cnf on Debian and Ubuntu).

Resolution

  1. Connect to the server using SSH.

  2. Make sure that the sockets to connect to the MySQL/MariaDB server specified in the files /etc/psa/psa.conf and /usr/local/psa/admin/conf/php.ini are the same as the socket defined in the file /etc/my.cnf (/etc/mysql/my.cnf on Debian and Ubuntu):

    # grep mysql.sock /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock

    # grep mysql.sock /etc/psa/psa.conf
    MYSQL_SOCKET /var/lib/mysql/mysql.sock

    # grep mysql.sock /usr/local/psa/admin/conf/php.ini
    pdo_mysql.default_socket="/var/lib/mysql/mysql.sock"

Exit mobile version