Search code examples
mysqlsocketsdebian

MySQL Daemon Lock issue


Last night, my MySQL server went down unexpectedly. On attempting to restart (with service mysql restart - I'm root) it merely 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).

I then tried to start the daemon manually (mysqld). The prompt would hang for about 2 seconds, and then return. On 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

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

I have looked around, and couldn't find a solution. Any help here?

Note: I am Running Debian 8 (Jessie) with MySQL community Server 5.7.10


Solution

  • Fixed. Add skip-external-locking to my.cnf under the [mysqld] section, and then reboot the entire system. This should fix it, for anyone who finds this. Also if you backed up your data, then attempted to restore and were told to rm ib* to make it work, you need the ibdata file.