所以 MySQL 在服务器重启后不会重启/启动。未编辑任何配置文件/进行任何更改。我和这个问题有同样的问题,apparmor 导致了这些日志条目:
Sep 27 11:18:53 staging audit[2986]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2986/status" pid=2986 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
Sep 27 11:18:53 staging audit[2986]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=2986 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=0
Sep 27 11:18:53 staging audit[2986]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2986/status" pid=2986 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
当这些 execptions 添加到/etc/apparmor.d/usr.sbin.mysqld
as 时:
# fix issue with mysql not restarting
/proc/*/status r,
/sys/devices/system/node/ r,
/sys/devices/system/node/node0/meminfo r,
# Allow network access
然后作为根:service apparmor reload; service mysql restart;
日志现在只显示:
Sep 27 11:25:10 staging systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Sep 27 11:25:10 staging systemd[1]: mysql.service: Unit entered failed state.
Sep 27 11:25:10 staging systemd[1]: mysql.service: Failed with result 'exit-code'.
Sep 27 11:25:10 staging systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Sep 27 11:25:10 staging systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Sep 27 11:25:10 staging systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Sep 27 11:25:11 staging systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
我没有进行任何配置更改,所以我真的不知道该去哪里找。我打算重新安装 MySQL,但是,我有我没有备份的数据:(请帮助