Link-Team

FIX for MYSQL/MariaDB! MySQL is not running, but lock exist

MySQLprocess is not running on the server. When I try to connect to it I get the following error :-

==================

root@server [~]# mysql
ERROR 2002 (HY000): Can’t connect to local MySQLserver through socket ‘/var/lib/mysql/mysql.sock’ (2)
root@server [~]# /etc/init.d/mysql status
ERROR!MySQL is not running, but lock exists
root@server [~]#

==================

When checked with the MySQLservice I got this error

==================

root@server [~]# /etc/init.d/mysql status

ERROR!MySQL is not running, but lock exists
root@server [~]#

==================

Here are the steps that should fix the issue.

root@server [~]# rm /var/lock/subsys/mysql
rm: remove regular empty file `/var/lock/subsys/mysql’? y

root@server [~]# /etc/init.d/mysql start

If still it doesn’t solve the issue, The best possibility is that the mysqlPID file was left after the system restart and I assume that MySQLserver was not stopped properly.

So please check MySQLprocess by following command

root@server [~]# top |grep mysql

OR

root@server [~]# ps aufx | grep mysql

If it shows the MySQLprocess, Kill that MySQLprocess and again run the command :-

root@server [~]# rm /var/lock/subsys/mysql

and start the MySQLservice by

root@server [~]# /etc/init.d/mysql start

This should resolve the issue

# Note : There could be some chances that your disk usage 100% full.

root@server [~]# df -h

If that one is usr, var or tmp then you can remove old logs.

=================

If you need assistance with this or any other technical issue, feel free to contact our team for advice and support.

 

*Our IT technical support officers monitor and maintain the computer systems and networks of an organisation. You could be installing and configuring computer systems, diagnosing hardware and software faults and solve technical and applications problems, either over the phone or in person.