Symptoms
-
Unable to check the Mysql/Mariadb status:
# systemctl status mariadb
ERROR! MariaDB is running but PID file could not be found -
Mysql/Mariadb may fail with such error as well:
ERROR 2002 (HY000): Can't connect to local server through socket '/var/lib/mysql/mysql.sock' (111)
-
Mysql/MariaDB was upgraded according to KB article How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.x on Linux
-
/var/run/mariadb
directory doesn't exist:# ls -la /var/run/mariadb
ls: cannot access /var/run/mariadb: No such file or directory
Cause
There is no PID file for a Mysql/Mariadb server.
Resolution
-
Connect to the server using SSH
-
Create a
/var/run/mariadb
directory and set ownership:# mkdir /var/run/mariadb
# chown mysql:mysql /var/run/mariadb
/var/run/mariadb: directory -
Restart Mysql/Mariadb service:
# systemctl restart mariadb.service