1
 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[1]: mysqld.service: Failed with result 'exit-code'.
Dec 27 19:02:07 j systemd[1]: Failed to start MySQL 8.0 database server.
Dec 27 19:02:07 j systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
Dec 27 19:02:07 j systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 5.
Dec 27 19:02:07 j systemd[1]: Stopped MySQL 8.0 database server.
Dec 27 19:02:07 j systemd[1]: mysqld.service: Start request repeated too quickly.
Dec 27 19:02:07 j systemd[1]: mysqld.service: Failed with result 'exit-code'.
Dec 27 19:02:07 j systemd[1]: 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.
1
  • /usr/libexec/mysql-check-socket is failing. Also look at the items at the end of your log provided.
    – danblack
    Dec 31, 2022 at 2:25

1 Answer 1

0

Have you checked what is in the MySQL error log? Depends on the details but could be in the normal syslog output (e.g. /var/log/messages), or could be ${datadir}/${hostname}.err

Slow down, don't panic, and first of all make sure mysqld is stopped. Check if any mysqld/mariadbd processes exist:

ps -ef | grep mysqld
ps -ef | grep mariadbd

If mysqld/mariadbdb processes are running, stop the processes. Try stopping the nice way (systemctl stop mysql/mariadb) and if they fail, kill -9 <pid>.

Check the error log before you continue.

Then start mysql/mariadb again: (systemctl start mysql/mariadb)

Check the error log again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.