MySQL Daemon Lock issue
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.
I had following error
[ERROR] Unix socket lock file is empty /var/lib/mysql/mysql.sock.lock.
This error came up as a result that my server was lacking space 100% use (see below)
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 41153856 28531384 12187364 100% /
Make sure the folder exists with the proper permissions
chown mysql:mysql /var/lib/mysql/
And make sure to delete the file so the mysql server could generate a new one
rm /var/lib/mysql/mysql.sock.lock
Posting this answer, in case it helps someone with the same config as me. I had similar issue with this configuration:
Host OS: Ubuntu 20.04
, MySql server: 8.0
The following error was seen in /var/log/mysql/error.log
during run of systemctl start mysql
[ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
Fix was similar:
mkdir -p /var/run/mysqld/
chmod 777 /var/run/mysqld/
And of course, I had enough space wherever mysql server was being installed.
I just ran into this. The mysql install was a little weird and was missing /var/run/mysqld/
MySQLd was attempting to create the socket and lock file but the parent directory was missing. I simply created the directory
sudo mkdir /var/run/mysqld
chowned it to mysql
sudo chown mysql:mysql /var/run/mysqld
I was then able to start mysqld normally.