你好,我的 mySql 服务器几个小时前崩溃了,现在我无法再次启动它。我正在运行此命令来启动 mySql:sudo /etc/init.d/mysql start
运行以下命令时收到此错误消息:
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed. See "systemctl status mysql.service" and "journalctl -xe" for details.
failed!
输出systemctl status mysql.service
:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) since ons 2016-07-06 13:38:31 CEST; 1min 41s ago
Process: 8062 ExecStart=/usr/bin/mysqld_safe (code=exited, status=0/SUCCESS)
Process: 8059 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 8062 (code=exited, status=0/SUCCESS); : 8063 (mysql-systemd-s)
CGroup: /system.slice/mysql.service
└─control
├─8063 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─8768 sleep 1
jul 06 13:38:31 ubuntuServerEmil systemd[1]: Starting MySQL Community Server...
jul 06 13:38:31 ubuntuServerEmil mysqld_safe[8062]: 160706 13:38:31 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
jul 06 13:38:31 ubuntuServerEmil mysqld_safe[8062]: 160706 13:38:31 mysqld_safe Logging to '/var/log/mysql/error.log'.
jul 06 13:38:31 ubuntuServerEmil mysqld_safe[8062]: 160706 13:38:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
这看起来像是一个日志错误但我该如何修复它呢?
更新在日志中发现以下错误:/var/log/mysql/error.log
2016-07-06 07:15:03 58630 [ERROR] /usr/sbin/mysqld: unknown variable 'audit-log=ON'
答案1
在我发现错误信息后/var/log/mysql/error.log
2016-07-06 07:15:03 58630 [ERROR] /usr/sbin/mysqld: unknown variable 'audit-log=ON'
然后我打开配置文件/etc/mysql/my.cnf
并找到一行包含该语句的行,audit-log=ON
我删除了该行并测试重新启动服务器,sudo /etc/init.d/mysql start
第一次没有起作用,但sudo /etc/init.d/mysql start
再次运行后,MySql 服务器启动并再次正常工作。