ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory

Refers to:

  • Plesk for Linux
  • MT:0ac792617f4d23ab0ed335c467a47478
  • MG:0aa5080727f12477c01dd2b90700a907
  • MT:4e900876aec7efabd2de223fce407e95
  • MG:2eb8d2699e722503bf79ae1c7819dc4e
  • MT:5502d7f7ac37d6235c7a736c9a877098
  • MT:751970acdc0d25fca1805d853ff70a01
  • MT:d715a1177f18fc8b1f458f9c61b7a929
  • MT:e3416d42bee6f7f17157a8c6173af0a3

Created:

2016-11-16 13:22:22 UTC

Modified:

2017-02-21 11:28:56 UTC

1

Was this article helpful?


Have more questions?

Submit a request

ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory

Symptoms

Plesk Panel displays the below error upon logging in:

ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory

Cause

Plesk PHP configuration file contains incorrect option for pdo_mysql socket file (or one of the include files does so):

[root@~]# grep pdo_mysql /usr/local/psa/admin/conf/php.ini
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock

Resolution

  1. Find out the current location for the mysql.sock file:

    # ps ax | grep mysql.sock | grep -v grep

    21731 pts/1 S 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
    22046 pts/1 Sl 0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
  2. Make sure that /usr/local/psa/admin/conf/php.ini' contains the same socket option as specified in '/etc/my.cnf' :

    # grep socket /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock
  3. Also check the file '/etc/psa/psa.conf' for the same option:

    # grep -i socket /etc/psa/psa.conf
    MYSQL_SOCKET /var/lib/mysql/mysql.sock
  4. Check that cron tasks does not contain MySQL sheduled restart:

    # grep -i mysqld /var/spool/cron/*
  5. Comment pdo_mysql.default_socket in /usr/local/psa/admin/conf/php.ini

    ;pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
  6. Restart sw-cp-server:

    /etc/init.d/sw-engine restart
    /etc/init.d/sw-cp-server restart
Have more questions? Submit a request
Please sign in to leave a comment.