Job for mysqld.service failed because the control process exited with error code.

服务器太卡了,重启了一下服务器发现mysql没有自动启动,于是手动启动,执行命令

systemctl start mysqld.service

报错如下

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

根据提示执行命令

systemctl status mysqld.service

输出信息

● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2021-06-17 15:23:25 CST; 9s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 24795 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
  Process: 24772 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

Jun 17 15:23:25 izmbybxmz systemd[1]: Failed to start MySQL Server.
Jun 17 15:23:25 izmbybxmz systemd[1]: Unit mysqld.service entered failed state.
Jun 17 15:23:25 izmbybxmz systemd[1]: mysqld.service failed.
Jun 17 15:23:25 izmbybxmz systemd[1]: mysqld.service holdoff time over, scheduling restart.
Jun 17 15:23:25 izmbybxmz systemd[1]: Stopped MySQL Server.
Jun 17 15:23:25 izmbybxmz systemd[1]: start request repeated too quickly for mysqld.service
Jun 17 15:23:25 izmbybxmz systemd[1]: Failed to start MySQL Server.
Jun 17 15:23:25 izmbybxmz systemd[1]: Unit mysqld.service entered failed state.
Jun 17 15:23:25 izmbybxmz systemd[1]: mysqld.service failed.

看不懂,只知道mysqld进程启动失败了,(code=exited, status=1/FAILURE)

执行命令

journalctl -xe

输出信息看不懂,也没啥用

跑去查看日志,先找到日志目录

mysql8官方说明

  • /etc/my.cnf or /etc/mysql/my.cnf (RPM platforms)

  • /etc/mysql/mysql.conf.d/mysqld.cnf (Debian platforms)

执行命令

less /etc/my.cnf

log-error=/var/log/mysqld.log

再执行命令

tailf  /var/log/mysqld.log

发现不打印日志,瞬间石化,继续百度

找到了一个大佬的文章,上面提到磁盘空间不足的问题,于是跟着大佬执行命令

df

Filesystem     1K-blocks     Used Available Use% Mounted on
devtmpfs         1929800        0   1929800   0% /dev
tmpfs            1940100        0   1940100   0% /dev/shm
tmpfs            1940100      468   1939632   1% /run
tmpfs            1940100        0   1940100   0% /sys/fs/cgroup
/dev/vda1       41151808 41129808         0 100% /
tmpfs             388020        0    388020   0% /run/user/1000

发现根目录可用空间为0,这才是导致mysql启动失败的原因

执行命令挨个目录分析

du -shc * | sort -h

发现nacos的日志占了12G,删掉日志mysql能正常启动了。

 

service mysqld status


Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-06-17 15:45:37 CST; 28min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 29501 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 29346 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 29504 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─29504 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Jun 17 15:45:34 izmxbybxmz systemd[1]: Starting MySQL Server...
Jun 17 15:45:37 izmxbybxmz systemd[1]: Started MySQL Server.

 

大佬文章

mysql官方说明

你可能感兴趣的:(shell,mysql)