Attempting to start the MySQL service results in the following error:
[ERROR] Unix socket lock file is empty /var/lib/mysql/mysql.sock.lock. [ERROR] Unable to setup unix socket lock file.
Below were the errors in mysql error log
2021-01-06T01:29:39.630848Z 0 [Note] – ‘127.0.0.1’ resolves to ‘127.0.0.1’;
2021-01-06T01:29:39.630871Z 0 [Note] Server socket created on IP: ‘127.0.0.1’.
2021-01-06T01:29:39.630932Z 0 [ERROR] Unix socket lock file is empty /var/lib/mysql/mysql.sock.lock.
2021-01-06T01:29:39.630943Z 0 [ERROR] Unable to setup unix socket lock file.
2021-01-06T01:29:39.630952Z 0 [ERROR] Aborting
A stale lock file is preventing the MySQL service from starting up. The ‘stat’ command can be used to compare the age of the lock file to the current time, in order to confirm that the lock file is stale:
# stat /var/lib/mysql/mysql.sock.lock
The above command should confirm the presence of an old lock file that is empty.
It can be difficult to determine why a stale lock file was left behind, however, moving the stale lock file aside should allow MySQL to start up normally. The following commands will need to be executed as the root user via WHM’s Terminal application, or via shell:
# mkdir -v /root/stale_mysql_lock_files
# mv -v /var/lib/mysql/mysql.sock.lock /root/stale_mysql_lock_files