赞
踩
打开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.
查看详细信息
service mysql status
Process: 2429 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
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'.
通过以上信息根本分析不出问题原因。
进入到Mysql日志目录下
/var/log/mysql
tail -f error.log
并没有看到详细的Mysql启动日志,所以日志并无参考价值
/var/log/
tail -f syslog
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.
进行配置文件的更改
/etc/mysql/mysql.conf.d
vim mysqld.cnf
将set去掉,改成character_set_server=utf8
MySQL的配置文件设置错误后,就会导致一些异常出现。
遇到错误时,一定要第一时间查看服务日志和系统日志,有助于快速排错。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。