Sample Header Ad - 728x90

How to solve ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

1 vote
1 answer
5363 views
ps ax | grep mysql 38737 pts/4 R+ 0:00 grep --color=auto mysql [root@ ~]# chown mysql:mysql -R /var/lib/mysql/* [root@ ~]# chmod 755 -R /var/lib/mysql/* [root@ ~]# service mysql restart Redirecting to /bin/systemctl restart mysql.service Failed to restart mysql.service: Unit mysql.service not found. [root@ ~]# mysql > ERROR 2002 (HY000): Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (111) [root@ ~]# sudo pkill mysql [root@ ~]# sudo pkill mysqld [root@ ~]# sudo service mysql restart Redirecting to /bin/systemctl restart mysql.service Failed to restart mysql.service: Unit mysql.service not found. [root@ ~]# sudo systemctl restart mysqld Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. [root@ ~]# sudo systemctl status mysqld ● mysqld.service - MySQL 8.0 database server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2022-12-27 19:02:07 UTC; 7s ago Process: 39028 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS) Process: 39004 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=1/FAILURE) Main PID: 33163 (code=killed, signal=KILL) Dec 27 19:02:07 j systemd: mysqld.service: Failed with result 'exit-code'. Dec 27 19:02:07 j systemd: Failed to start MySQL 8.0 database server. Dec 27 19:02:07 j systemd: mysqld.service: Service RestartSec=100ms expired, scheduling restart. Dec 27 19:02:07 j systemd: mysqld.service: Scheduled restart job, restart counter is at 5. Dec 27 19:02:07 j systemd: Stopped MySQL 8.0 database server. Dec 27 19:02:07 j systemd: mysqld.service: Start request repeated too quickly. Dec 27 19:02:07 j systemd: mysqld.service: Failed with result 'exit-code'. Dec 27 19:02:07 j systemd: Failed to start MySQL 8.0 database server. [root@ ~]# sudo systemctl start mysqld Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
Asked by Bill Rogers (11 rep)
Dec 27, 2022, 07:06 PM
Last activity: Jul 17, 2025, 04:06 PM