Plesk inaccessible: ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] Connection refused

Created:

2017-06-13 04:14:40 UTC

Modified:

2017-08-16 16:24:39 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Plesk inaccessible: ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] Connection refused

Applicable to:

  • Plesk Onyx for Linux

Symptoms

1. Plesk login page shows the following error:

ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] Connection refused

2. In /var/log/mysqld.log the following error can be found:

2017-06-13T03:48:05.372899Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
2017-06-13T03:48:05.372914Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory

If this is MariaDB database server the following error occurs:

In /var/log/mariadb/mariadb.log
170713 18:11:42 [ERROR] mysqld: Can't create/write to file '/var/run/mariadb/mariadb.pid' (Errcode: 2)
170713 18:11:42 [ERROR] Can't start server: can't create PID file: No such file or directory
170713 18:11:42 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

3. plesk repair command results in:

SQLSTATE[HY000] [2002] Connection refused
exit status 3

Cause

Directory /var/run/mysqld(MySQL) or /var/run/mariadb/ (MariaDB) is absent so the system cannot create PID file for the service on startup.

Resolution

Create missing directory manually and make sure that the directory ownership is mysql:mysql :

# mkdir /var/run/mysqld 
# chown mysql:mysql /var/run/mysqld

In case of MariaDB service and CentOS 7 recreate a symbolic link to /run directory:

# cd /var

# ln -s ../run run
Have more questions? Submit a request
Please sign in to leave a comment.