ubuntu16.04启动mysql,MySQL无法启动Ubuntu 16.04.2 x64

So MySQL won't restart/start after a server reboot. No configuration files have been edited / any changes made.

I have the same problem as this question where apparmor is causing these log entries:

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

When these execptions are added to /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

Then as root : service apparmor reload; service mysql restart;

The logs now only display:

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

I have not made any configuration changes so I don't really know where else to look. I was going to reinstall MySQL, however, I have data that I don't have backed up :( pls help

解决方案

So i've managed to get it working although i don't know how this worked, but i ran:

apt-get remove mysql*; apt-get install mysql-server mysql-client ;

the first time i was still unable to start mysql. And then i ran it again and mysql has started to work again. I also was able to remove the lines:

/proc/*/status r,

/sys/devices/system/node/ r,

/sys/devices/system/node/node0/meminfo r,

from /etc/apparmor.d/usr.sbin.mysqld and reloaded apparmor.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值