MySQL service cannot start.
The errors like the following are shown when querying the status of the service:
# service mysqld status
mysqld dead but subsys locked
# service mariadb status
ERROR! MariaDB is not running, but lock file (/var/lock/subsys/mysql) exists
Amount of free memory on the server is low.
MySQL failed because of lack of free memory and left the
/var/lock/subsys/mysqld file behind.
It is required to remove
/var/lock/subsys/mysqld file, free up some memory and start MySQL.
Note: Actions described below require administrative skills, in case you have any difficulties with it, reboot the server to fix the issue. Consider increasing the amount of RAM on the server in order to prevent such issues from happening in the future.
Log in to the server via SSH.
# rm -f /var/lock/subsys/mysqld
Check the amount of free memory with “
free -m” command. In case there is more then 200M free, skip this step. In case the amount of free memory is low, kill processes that consume most of the memory. For example, stop the Apache temporary:
# service apache2 stop
# service httpd stop
# service mysqld start
# service mariadb start
In case Apache is stopped on step 3, start it back:
# service apache2 start
# service httpd start