2017-09-27 73 views
0

因此,在服務器重新引導後,MySQL不會重新啓動/啓動。沒有編輯配置文件/進行任何更改。 我有同樣的問題,因爲這question其中的AppArmor是導致這些日誌條目:mysql不會啓動Ubuntu 16.04.2 x64

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 爲:

# fix issue with mysql not restarting 
    /proc/*/status r, 
    /sys/devices/system/node/ r, 
    /sys/devices/system/node/node0/meminfo r, 
# Allow network access 

然後作爲root: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,但是,我有我沒有備份的數據:(請幫助

+0

我試圖重新安裝mysql服務器,但仍然只有一個錯誤:'mysql.service:主進程退出,代碼=退出,狀態= 1 /失敗' – jwtea

回答

0

所以,我已經成功地得到它的工作,雖然我不知道這是如何工作,但我跑了: apt-get remove mysql*; apt-get install mysql-server mysql-client ; 我第一次仍然無法啓動mysql。然後我再次運行它,並且mysql已經開始重新工作。刪除線路:

/proc/*/status r, /sys/devices/system/node/ r, /sys/devices/system/node/node0/meminfo r,

/etc/apparmor.d/usr.sbin.mysqld並重新裝載apparmor。

0

你嘗試過這對Ubuntu 16.04和高達

sudo systemctl start mysql 
+0

輸出或效果沒有差異 – jwtea

+0

mkdir/var/run/mysqld ,touch /var/run/mysqld/mysqld.sock, chown -R mysql/var/run/mysqld。 然後重新啓動 –

+0

我已經看到了這一點,但我不知道這是要解決什麼? – jwtea