MySQL Daemon Lock Error

Last night my MySQL server crashed unexpectedly. When you try to reboot (with service mysql restart - I'm root), it just hangs. With the mysql -u root -p command, I get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) . Then I tried to start the daemon manually ( mysqld ). The request will hang for about 2 seconds and then return. Upon closer inspection of the error logs, I got:

2016-01-22T19:18:32.399584Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.

2016-01-22T19:18:32.399622Z 0 [ERROR] Unable to setup unix socket lock file.

2016-01-22T19:18:32.399646Z 0 [ERROR] Aborting

Then I tried chown mysql /var/run/mysqld , chmod -R 775 /var/run/mysqld and apt-get install mysql-community-server --reinstall . Bad luck.

I looked around and could not find a solution. Any help here?

Note. I am running Debian 8 (Jessie) with the MySQL Server 5.7.10 community

+20
mysql debian sockets
source share
8 answers

Fixed. Add skip-external-locking to my.cnf in the [mysqld] section, and then reboot the entire system. This should fix it, for those who find it. Also, if you backed up the data, then tried to restore and told rm ib* to work, you need the ibdata file.

-2
source share

I just ran into this. The mysql installation was a bit strange and missing / Var / Work / tuzdy /

MySQLd tried to create a socket and lock file, but the parent directory was missing. I just created a directory

 sudo mkdir /var/run/mysqld 

chowned to to mysql

 sudo chown mysql:mysql /var/run/mysqld 

Then I was able to start mysqld normally.

+53
source share

Today I had the same problem on my Ubuntu server. But I think the solution is NOT to disable the lock. In my case, looking at the syslog ( dmesg | tail and journalctl -xe ) showed that the problem with the aperson and a solution can be found in this question .

+6
source share

There may also be insufficient disk space.

0
source share

The below commands have helped me.

 sudo mkdir /var/run/mysqld sudo chmod 777 /var/run/mysqld -R 
0
source share

I had the following error

 [ERROR] Unix socket lock file is empty /var/lib/mysql/mysql.sock.lock. 

This error occurred as a result of the fact that my server did not have enough space for 100% (see below)

 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 41153856 28531384 12187364 100% / 

Make sure the folder exists with the appropriate permissions.

 chown mysql:mysql /var/lib/mysql/ 

And be sure to delete the file so that mysql server can generate a new one

 rm /var/lib/mysql/mysql.sock.lock 
0
source share

If you use Docker to start MySQL, check to see if there is enough disk space in the Docker settings.

0
source share

Rename /var/lib/mysql/mysql.sock.lock & amp; /var/lib/mysql/mysql.sock to /var/lib/mysql/mysql.sock.lock.bck & amp; / var / lib / mysql /mysql.sock.bck respectively and run mysqld. It works

-one
source share

All Articles