Plesk login page shows the following error:
ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000]  Connection refused
/var/log/mysqld.logthe following error can be found:
[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
[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
/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
# ls -lad /var/run/mariadb/
ls: cannot access '/var/run/mariadb/': No such file or directory
MySQL directory is absent so the system cannot create PID file for the service on startup.
Note: This article may require additional administrative knowledge to apply. If any help required, contact server’s administrator or hosting support.
Connect to the server via SSH.
Create the configuration file with necessary content:
# echo "d /var/run/mysqld 0755 mysql mysql -" >> /etc/tmpfiles.d/mysql.conf
# echo "d /var/run/mariadb 0755 mysql mysql -" >> /etc/tmpfiles.d/mysql.conf
Reboot the server.
Click on a section to expand