记一次MySQL服务启动报错,无日志更新故障修复

2022-04-03 分类:教程 作者:刺猬

今天有台服务器启动后,执行service mysqld start提示无法启动,但是未输出任何有用的日志信息,具体如下:

[root@localhost bin]# service mysqld start
Starting mysqld:  [FAILED]

查看日志:

[root@localhost bin]# journalctl -xe
Apr 03 20:45:15 localhost systemd[1]: Starting SYSV: MySQL database server....
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Apr 03 20:45:17 localhost mysqld[22569]: MySQL Daemon failed to start.
Apr 03 20:45:17 localhost mysqld[22569]: Starting mysqld:  [FAILED]
Apr 03 20:45:17 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
Apr 03 20:45:17 localhost systemd[1]: Failed to start SYSV: MySQL database server..
-- Subject: Unit mysqld.service  has failed

通过上面信息看不出任何问题,查看mysql错误日志也无日志新增。

解决办法:

通过单独启动mysqld_safe ,查到一些日志信息:

[root@localhost bin]# ./mysqld_safe 
2022-04-03T12:56:45.867947Z mysqld_safe Logging to '/var/log/mysqld1.log'.
2022-04-03T12:56:45.895933Z mysqld_safe Starting mysqld daemon with databases from /mnt/data/mysql
2022-04-03T12:56:49.159407Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

日志提示mysql.pid文件ended,判断为/var/run/mysqld/目录没有mysql用户的操作权限。

执行:

chown -R mysql.mysql /var/run/mysqld/
service mysqld start

至此,可以正常启动MySQL。

此次故障为服务器重启后,对/var/run/mysqld/目录操作权限丢失,如果下次遇到启动MySQL无报错的情况,可以尝试单独启动mysqld_safe,可以看到一些报错信息。

» 本文链接:记一次MySQL服务启动报错,无日志更新故障修复
» 转载请注明来源:刺客博客
» 如果文章失效或者安装失败,请留言进行反馈。
继续阅读