MySQL 服务器昨晚运行良好,但今天早上,当我尝试访问 Bugzilla 服务器时,我发现它已关闭。我尝试启动它,但出现以下错误:
Job for mysql.service failed because the control process exited with
error code. See "systemctl status mysql.service" and "journalctl -xe" for
details.
我在谷歌上搜索了几次,找到了一堆问题。我尝试了一些答案,但服务器仍然瘫痪。我有足够的空间,
root@GBRTEF01LX005:/home/bzadmin# df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 5.8M 390M 2% /run
/dev/mapper/CMS--UBN--TEMPLATE--1--vg-root 75G 4.8G 66G 7% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 472M 106M 342M 24% /boot
tmpfs 396M 0 396M 0% /run/user/1001
我还为 InnoDB 添加了更多交换空间,
innodb_buffer_pool_size = 20M
这是我找到的建议之一,最后,这是最后 30 行journalctl -xe
,
root@GBRTEF01LX005:/home/bzadmin# journalctl -xe | tail -30
Feb 25 16:26:23 GBRTEF01LX005 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.
Feb 25 16:26:23 GBRTEF01LX005 systemd[1]: mysql.service: Unit entered failed state.
Feb 25 16:26:23 GBRTEF01LX005 systemd[1]: mysql.service: Failed with result 'exit-code'.
Feb 25 16:26:23 GBRTEF01LX005 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Feb 25 16:26:23 GBRTEF01LX005 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.
Feb 25 16:26:23 GBRTEF01LX005 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.
Feb 25 16:26:23 GBRTEF01LX005 audit[11846]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/11846/status" pid=11846 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=107
Feb 25 16:26:23 GBRTEF01LX005 audit[11846]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=11846 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=0
Feb 25 16:26:23 GBRTEF01LX005 audit[11846]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/11846/status" pid=11846 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=107
Feb 25 16:26:23 GBRTEF01LX005 kernel: audit: type=1400 audit(1519575983.239:317): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/11846/status" pid=11846 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=107
Feb 25 16:26:23 GBRTEF01LX005 kernel: audit: type=1400 audit(1519575983.239:318): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=11846 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=0
Feb 25 16:26:23 GBRTEF01LX005 kernel: audit: type=1400 audit(1519575983.239:319): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/11846/status" pid=11846 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=107
Feb 25 16:26:25 GBRTEF01LX005 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
任何帮助都将不胜感激!谢谢。
何塞
答案1
我在装有 Linux 5.4.65 的 Armbian 20.08.5 Bionic 上遇到了此错误。
问题在于 处缺少日志目录/var/log/mysql
,如 中的日志条目所示。创建具有所有者和组的/var/log/syslog
目录帮我解决了这个问题。/var/log/mysql
mysql
adm
mkdir /var/log/mysql
chown mysql:adm /var/log/mysql
# start mysql with your init system (e.g. systemctl start mysql)