今天更新了系统,mysql服务器无法启动:
我收到以下错误:
Aug 14 14:32:09 VULTURUS kernel: [ 1996.413190] init: mysql main process (14122) terminated with status 1
Aug 14 14:32:09 VULTURUS kernel: [ 1996.413262] init: mysql main process ended, respawning
Aug 14 14:32:10 VULTURUS kernel: [ 1997.373479] init: mysql post-start process (14123) terminated with status 1
Aug 14 14:32:10 VULTURUS kernel: [ 1997.391012] type=1400 audit(1344947530.964:242): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=14156 comm="apparmor_parser"
Aug 14 14:32:11 VULTURUS kernel: [ 1997.453824] type=1400 audit(1344947531.028:243): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/media/WESYS_DATA/MySql_LX/" pid=14160 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=115 ouid=0
Aug 14 14:32:11 VULTURUS kernel: [ 1997.456707] init: mysql main process (14160) terminated with status 1
Aug 14 14:32:11 VULTURUS kernel: [ 1997.456775] init: mysql respawning too fast, stopped
但是我已经在 /etc/apparmor.d/usr.sbin.mysqld 中添加了例外
# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>
/usr/sbin/mysqld {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/user-tmp>
#include <abstractions/mysql>
#include <abstractions/winbind>
capability dac_override,
capability sys_resource,
capability setgid,
capability setuid,
network tcp,
/etc/hosts.allow r,
/etc/hosts.deny r,
/etc/mysql/*.pem r,
/etc/mysql/conf.d/ r,
/etc/mysql/conf.d/* r,
/etc/mysql/*.cnf r,
/usr/lib/mysql/plugin/ r,
/usr/lib/mysql/plugin/*.so* mr,
/usr/sbin/mysqld mr,
/usr/share/mysql/** r,
/var/log/mysql.log rw,
/var/log/mysql.err rw,
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
/var/run/mysqld/mysqld.pid w,
/var/run/mysqld/mysqld.sock w,
/run/mysqld/mysqld.pid w,
/run/mysqld/mysqld.sock w,
/sys/devices/system/cpu/ r,
/media/WESYS_DATA/MySql_LX/** rwk,
/media/WESYS_DATA/MySql_LX/** rwk,
# Site-specific additions and overrides. See local/README for details.
#include <local/usr.sbin.mysqld>
}
答案1
以下两行/etc/apparmor.d/usr.sbin.mysqld重叠。
/media/WESYS_DATA/MySql_LX/** rwk,
/media/WESYS_DATA/MySql_LX/** rwk,
当您将这些行替换为下面的行时,您的问题可能会得到解决。
/media/WESYS_DATA/MySql_LX/ r,
/media/WESYS_DATA/MySql_LX/** rwk,
答案2
就我的情况来说,信息如下:
mysql respawning too fast
我发现syslog
这是因为我已删除了 apparmor,但忘记重新启动服务器。
重新启动服务器后,mysql 启动正常。
答案3
就我的情况来说,在 Ubuntu 从 11.04 更新到 11.10 期间出现了无限循环(并且安装没有继续):
Sep 24 21:50:05 soft kernel: [ 4926.795768] type=1400 audit(1380048605.174:160): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=10215 comm="apparmor_parser"
Sep 24 21:50:05 soft kernel: [ 4926.954977] type=1400 audit(1380048605.334:161): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/srv/mysql/soft.lower-test" pid=10219 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Sep 24 21:50:05 soft kernel: [ 4926.955011] type=1400 audit(1380048605.334:162): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/srv/mysql/soft.lower-test" pid=10219 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Sep 24 21:50:05 soft kernel: [ 4927.043602] type=1400 audit(1380048605.424:163): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/srv/mysql/mysql/plugin.frm" pid=10219 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=102 ouid=102
Sep 24 21:50:05 soft kernel: [ 4927.087869] type=1400 audit(1380048605.464:164): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" name="/srv/mysql/ibdata1" pid=10219 comm="mysqld" requested_mask="rw" denied_mask="rw" fsuid=102 ouid=102
Sep 24 21:50:05 soft init: mysql main process (10219) terminated with status 1
解决方案:我在单独的窗口中登录,
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
然后跟踪系统日志并发现安装正常继续。
答案4
启用查询慢速日志后,我收到错误。原来,mysqld.conf
模板中的变量名称已从 更改为log_slow_queries
,现在应该是
slow-query-log-file = /var/log...
谢谢https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1610765/comments/35