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 r
It's best to look at the log files (/usr/local/var/mysql/*.local.err) before attempting any of the more generic answers.
In my case first it complained of not being able to open the socket file ([Server] Could not open unix socket lock file /tmp/mysql.sock.lock.
) and once I changed permissions, it complained of not being able to remove it! ([Server] Could not remove unix socket lock file /tmp/mysql.sock.lock errno 13.
)
Removed it and run mysql.server start and DONE.
I experienced the same issue today on my Ubuntu server. But I think the solution is NOT to disable locking. In my case, a look at the system log (dmesg | tail
and journalctl -xe
) revealed that it's an apparmor issue and the solution can be found in this question.
Rename /var/lib/mysql/mysql.sock.lock & /var/lib/mysql/mysql.sock to /var/lib/mysql/mysql.sock.lock.bck & /var/lib/mysql/mysql.sock.bck respectively and start mysqld. It works
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.