我尝试将数据库备份恢复到新创建的数据库,突然开始显示错误。无法通过套接字连接到本地 MySQL 服务器,/var/run/mysqld/mysqld.sock
因此我检查了/var/log/syslog
显示的错误,如下所示:
kernel: [50646755.461546] init: mysql main process (31830) terminated with status 1
kernel: [50646755.461590] init: mysql main process ended, respawning
kernel: [50646756.363273] init: mysql post-start process (31831) terminated with status 1
kernel: [50646756.380883] type=1400 audit(1404213477.915:91): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=31854 comm="apparmor_parser"
然后我尝试
cd /etc/apparmor.d/
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
从 apparmor 禁用 mysqld。
cat /sys/kernel/security/apparmor/profiles
/usr/sbin/tcpdump (enforce)
/usr/lib/connman/scripts/dhclient-script (enforce)
/usr/lib/NetworkManager/nm-dhcp-client.action (enforce)
/sbin/dhclient (enforce)
mysql 从 apparmor 中移除
然后我再次尝试启动 mysql,但显示错误。
tailf /var/log/syslog
kernel: [50647375.532797] init: mysql main process (32120) terminated with status 1
kernel: [50647375.532843] init: mysql main process ended, respawning
kernel: [50647376.405541] init: mysql post-start process (32121) terminated with status 1
init: mysql main process (32148) terminated with status 1
kernel: [50647376.611944] init: mysql main process ended, respawning
kernel: [50647377.490963] init: mysql post-start process (32149) terminated with status 1
kernel: [50647377.671609] init: mysql main process (32176) terminated with status 1
kernel: [50647377.671654] init: mysql respawning too fast, stopped
请帮助我,我需要使用同样令人兴奋的数据库。我不想失去它。