当前位置:   article > 正文

mysql ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE) 解决方法

mysql ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE) 解决方法

问题描述

打开Mysql服务时,提示启动失败,描述如下:
systemctl start mysql

Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xeu mysql.service" for details.
  • 1
  • 2

查看详细信息
service mysql status

 Process: 2429 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
  • 1

journalctl -xeu mysql.service

 ░░ An ExecStartPre= process belonging to unit mysql.service has exited.

░░ The process' exit code is 'exited' and its exit status is 1.
8月 11 09:29:18 jimbo-virtual-machine systemd[1]: mysql.service: Failed with result 'exit-code'.
  • 1
  • 2
  • 3
  • 4

通过以上信息根本分析不出问题原因。

查看Mysql日志

进入到Mysql日志目录下

/var/log/mysql
tail -f error.log 
  • 1
  • 2

并没有看到详细的Mysql启动日志,所以日志并无参考价值

查看系统日志

/var/log/
tail -f syslog
  • 1
  • 2

unknown variable 'set character_set_server=utf8 这个日志告诉我们无法启动的真正原因是Mysql的配置文件中有无法识别的变量

Aug 11 09:37:14 jimbo-virtual-machine systemd[1]: Starting MySQL Community Server...
***Aug 11 09:37:14 jimbo-virtual-machine mysql-systemd-start[2502]: ERROR: Unable to start MySQL server:
Aug 11 09:37:14 jimbo-virtual-machine mysql-systemd-start[2502]: 2022-08-11T01:37:14.666663Z 0 [ERROR] unknown variable 'set character_set_server=utf8'***
Aug 11 09:37:14 jimbo-virtual-machine mysql-systemd-start[2502]: 2022-08-11T01:37:14.668262Z 0 [ERROR] Aborting
Aug 11 09:37:14 jimbo-virtual-machine mysql-systemd-start[2502]: Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Aug 11 09:37:14 jimbo-virtual-machine mysql-systemd-start[2502]: Once the problem is resolved, restart the service.
Aug 11 09:37:14 jimbo-virtual-machine systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Aug 11 09:37:14 jimbo-virtual-machine systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 11 09:37:14 jimbo-virtual-machine systemd[1]: Failed to start MySQL Community Server.
Aug 11 09:37:14 jimbo-virtual-machine systemd[1]: mysql.service: Scheduled restart job, restart counter is at 4.
Aug 11 09:37:14 jimbo-virtual-machine systemd[1]: Stopped MySQL Community Server.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

解决方法

进行配置文件的更改

/etc/mysql/mysql.conf.d
 vim mysqld.cnf 
  • 1
  • 2

将set去掉,改成character_set_server=utf8

总结

MySQL的配置文件设置错误后,就会导致一些异常出现。
遇到错误时,一定要第一时间查看服务日志和系统日志,有助于快速排错。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/628142
推荐阅读
相关标签
  

闽ICP备14008679号