Articles in this section

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

DoNotDelete:docref Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux

Symptoms

  • Plesk login page shows the following error: 

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

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

    CONFIG_TEXT: [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)

  • The following error may be found in /var/log/mariadb/mariadb.log file:

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


    CONFIG_TEXT:2020-08-05 1:04:22 0 [ERROR] mysqld: Can't create/write to file '/var/run/mariadb/mariadb.pid' (Errcode: 13 "Permission denied")
    2020-08-05 1:04:22 0 [ERROR] Can't start server: can't create PID file: Permission denied

  • Directory /var/run/mysqld (for Debian and Ubuntu) or /var/run/mariadb/ (for CentOS) is absent or has incorrect permissions:

    Debian and Ubuntu:

    # ls -lad /var/run/mysqld
    ls: cannot access /var/run/mysqld: No such file or directory

    CentOS:

    # ls -lad /var/run/mariadb/
    ls: cannot access '/var/run/mariadb/': No such file or directory

Cause

MySQL directory is absent so the system cannot create PID file for the service on startup.

Resolution

Note: This article may require additional administrative knowledge to apply. If any help required, contact server’s administrator or hosting support.

  1. Connect to the server via SSH.

  2. Create the configuration file with necessary content:

    • For Debian/Ubuntu:

      # echo "d /var/run/mysqld 0755 mysql mysql -" >> /etc/tmpfiles.d/mysql.conf

    • For CentOS/RHEL/CloudLinux:

      # echo "d /var/run/mariadb 0755 mysql mysql -" >> /etc/tmpfiles.d/mysql.conf

  3. Reboot the server.

Click on a section to expand

Solution without reboot for CentOS/RHEL/CloudLinux
  1. Connect to the server via SSH.

  2. Run the commands below:

    # install -dpm770 -o mysql -g mysql /var/run/mariadb

    # systemctl start mariadb

Was this article helpful?

Comments

1 comment
Date Votes

Please sign in to leave a comment.