当我安装最新版本的 Drupal 时,MySQL 服务器停止工作。然后我重新安装了 MySQL 服务器,但没有成功。它无法启动。
输出sudo service mysql start
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
输出systemctl status mysql.service
? mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Sat 2017-05-13 23:40:38 UTC; 5s ago
Process: 32760 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 32744 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 32760 (code=exited, status=1/FAILURE); Control PID: 32763 (mysql-systemd-s)
Tasks: 2 (limit: 4915)
Memory: 736.0K
CPU: 58ms
CGroup: /system.slice/mysql.service
+-control
+- 308 sleep 1
+-32763 /bin/bash /usr/share/mysql/mysql-systemd-start post
May 13 23:40:38 ubuntu-512mb-tor1-01 systemd[1]: Starting MySQL Community Server...
May 13 23:40:38 ubuntu-512mb-tor1-01 mysql-systemd-start[32744]: my_print_defaults: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:40:38 ubuntu-512mb-tor1-01 mysql-systemd-start[32744]: my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:40:38 ubuntu-512mb-tor1-01 mysqld[32760]: mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:40:38 ubuntu-512mb-tor1-01 mysqld[32760]: mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:40:38 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
输出journalctl -xe
May 13 23:40:38 ubuntu-512mb-tor1-01 audit[32760]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=32760 comm="mysqld" requested_mask="
May 13 23:40:38 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718838.737:7854): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=3
May 13 23:40:38 ubuntu-512mb-tor1-01 audit[32760]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=32760 comm="mysqld" requested
May 13 23:40:38 ubuntu-512mb-tor1-01 audit[32760]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=32760 comm="mysqld" requested_mask="
May 13 23:40:38 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718838.741:7855): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/
May 13 23:40:38 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718838.741:7856): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=3
May 13 23:40:38 ubuntu-512mb-tor1-01 mysqld[32760]: mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:40:38 ubuntu-512mb-tor1-01 mysqld[32760]: mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:40:38 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 13 23:41:08 ubuntu-512mb-tor1-01 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is failed.
May 13 23:41:08 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Unit entered failed state.
May 13 23:41:08 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has begun starting up.
May 13 23:41:09 ubuntu-512mb-tor1-01 mysql-systemd-start[362]: my_print_defaults: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:41:09 ubuntu-512mb-tor1-01 mysql-systemd-start[362]: my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:41:09 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718869.245:7857): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378
May 13 23:41:09 ubuntu-512mb-tor1-01 audit[378]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378 comm="mysqld" requested_mask="r" den
May 13 23:41:09 ubuntu-512mb-tor1-01 audit[378]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=378 comm="mysqld" requested_mas
May 13 23:41:09 ubuntu-512mb-tor1-01 audit[378]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378 comm="mysqld" requested_mask="r" den
May 13 23:41:09 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718869.249:7858): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/
May 13 23:41:09 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718869.249:7859): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378
May 13 23:41:09 ubuntu-512mb-tor1-01 mysqld[378]: mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:41:09 ubuntu-512mb-tor1-01 mysqld[378]: mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
lines 2142-2184/2184 (END)
May 13 23:40:38 ubuntu-512mb-tor1-01 audit[32760]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=32760 comm="mysqld" requested_mask="
May 13 23:40:38 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718838.737:7854): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=3
May 13 23:40:38 ubuntu-512mb-tor1-01 audit[32760]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=32760 comm="mysqld" requested
May 13 23:40:38 ubuntu-512mb-tor1-01 audit[32760]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=32760 comm="mysqld" requested_mask="
May 13 23:40:38 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718838.741:7855): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/
May 13 23:40:38 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718838.741:7856): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/32760/status" pid=3
May 13 23:40:38 ubuntu-512mb-tor1-01 mysqld[32760]: mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:40:38 ubuntu-512mb-tor1-01 mysqld[32760]: mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:40:38 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
May 13 23:41:08 ubuntu-512mb-tor1-01 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is failed.
May 13 23:41:08 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Unit entered failed state.
May 13 23:41:08 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has begun starting up.
May 13 23:41:09 ubuntu-512mb-tor1-01 mysql-systemd-start[362]: my_print_defaults: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:41:09 ubuntu-512mb-tor1-01 mysql-systemd-start[362]: my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:41:09 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718869.245:7857): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378
May 13 23:41:09 ubuntu-512mb-tor1-01 audit[378]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378 comm="mysqld" requested_mask="r" den
May 13 23:41:09 ubuntu-512mb-tor1-01 audit[378]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=378 comm="mysqld" requested_mas
May 13 23:41:09 ubuntu-512mb-tor1-01 audit[378]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378 comm="mysqld" requested_mask="r" den
May 13 23:41:09 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718869.249:7858): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/
May 13 23:41:09 ubuntu-512mb-tor1-01 kernel: audit: type=1400 audit(1494718869.249:7859): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/378/status" pid=378
May 13 23:41:09 ubuntu-512mb-tor1-01 mysqld[378]: mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 24!
May 13 23:41:09 ubuntu-512mb-tor1-01 mysqld[378]: mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
May 13 23:41:09 ubuntu-512mb-tor1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
答案1
我只需删除mysql-server
包即可解决这个问题。
sudo apt remove mysql-server
我有 Ubuntu 和 LAMP,当我启动 LAMP 时,mysqld(mysql-server)无法运行。它引发的错误正是您的错误。我希望这个卸载软件包的解决方案mysql-server
对您有用。