简体   繁体   中英

why mysql cannot start on Ubuntu

Today when I tried to restart mysql, it showed

root@S128046:~# service mysql restart
Job for mysql.service failed because the control process exited with error 
code. See "systemctl status mysql.service" and "journalctl -xe" for details.

If I try systemctl status mysql.service , it says:

root@S128046:~# 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 Thu 2018-04-05 09:45:48 CST; 11s ago
 Main PID: 19848 (code=exited, status=1/FAILURE);         : 19849 (mysql-systemd-s)
    Tasks: 2
   Memory: 336.0K
      CPU: 754ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─19849 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─19903 sleep 1

Apr 05 09:45:48 S128046.domain systemd[1]: Stopped MySQL Community Server.
Apr 05 09:45:48 S128046.domain systemd[1]: Starting MySQL Community Server...
Apr 05 09:45:51 S128046.domain systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

And journalctl -xe says:

-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Apr 05 09:47:25 S128046.domain audit[20171]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/status" pid=20171 comm="mysqld" req
Apr 05 09:47:25 S128046.domain audit[20171]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=20171 comm="mysq
Apr 05 09:47:25 S128046.domain audit[20171]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/status" pid=20171 comm="mysqld" req
Apr 05 09:47:25 S128046.domain kernel: audit: type=1400 audit(1522892845.214:527): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/s
Apr 05 09:47:25 S128046.domain kernel: audit: type=1400 audit(1522892845.214:528): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/
Apr 05 09:47:25 S128046.domain kernel: audit: type=1400 audit(1522892845.214:529): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20171/s
Apr 05 09:47:27 S128046.domain systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 09:47:56 S128046.domain 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.
Apr 05 09:47:56 S128046.domain systemd[1]: mysql.service: Unit entered failed state.
Apr 05 09:47:56 S128046.domain systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 05 09:47:56 S128046.domain systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
-- Unit mysql.service has begun starting up.
Apr 05 09:47:56 S128046.domain kernel: audit: type=1400 audit(1522892876.943:530): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/s
Apr 05 09:47:56 S128046.domain kernel: audit: type=1400 audit(1522892876.943:531): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/
Apr 05 09:47:56 S128046.domain kernel: audit: type=1400 audit(1522892876.943:532): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/s
Apr 05 09:47:56 S128046.domain audit[20273]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/status" pid=20273 comm="mysqld" req
Apr 05 09:47:56 S128046.domain audit[20273]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=20273 comm="mysq
Apr 05 09:47:56 S128046.domain audit[20273]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20273/status" pid=20273 comm="mysqld" req
Apr 05 09:47:59 S128046.domain systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

I do not why but mysql worked well for the past months. Any help would be appreciated, thank you in advance.

try using superuser in ubuntu

sudo service mysql restart

this may work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM