MySQL 服务无法正常重启



我在ubuntu 14.04上安装了mysql服务器(版本:5.5.54(。我有一个脚本,每天优化数据库,然后重新启动mysql服务。

今天,我注意到MySQL

服务器无法正确重新启动,当我连接到MySQL时,我遇到了此错误。

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

在系统日志中,我找到以下消息:

Mar 24 01:20:01 dbs kernel: [35113.530913] init: mysql main process ended, respawning
Mar 24 01:20:01 dbs kernel: [35113.549509] audit_printk_skb: 36 callbacks suppressed
Mar 24 01:20:01 dbs kernel: [35113.549514] audit: type=1400 audit(1490314801.743:24): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/sbin/mysqld" pid=21133 comm="apparmor_parser"
Mar 24 01:20:01 dbs kernel: [35113.568126] audit: type=1400 audit(1490314801.763:25): apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.err" pid=21145 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=105 ouid=105

MySQL AppArmor 文件

# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>
/usr/sbin/mysqld {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/user-tmp>
  #include <abstractions/mysql>
  #include <abstractions/winbind>
  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,
  network tcp,
  /etc/hosts.allow r,
  /etc/hosts.deny r,
  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/*.cnf r,
  /usr/lib/mysql/plugin/ r,
  /usr/lib/mysql/plugin/*.so* mr,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,
  /var/lib/mysql-files/ r,
  /var/lib/mysql-files/** rwk,
  /var/log/mysql/ r,
  /var/log/mysql/* rw,
  /var/run/mysqld/mysqld.pid rw,
  /var/run/mysqld/mysqld.sock w,
  /run/mysqld/mysqld.pid rw,
  /run/mysqld/mysqld.sock w,
  /sys/devices/system/cpu/ r,
  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.sbin.mysqld>
}

我通过更新apparmor配置文件解决了它。试试这个:

 apt install apparmor-profiles

Apparmor重新启动,我能够正常启动数据库:

 sudo service mysql start
这对

我有用:(来源:https://forum.snapcraft.io/t/unable-to-install-snap-from-store-or-locally/4629/15(

首先删除 apparmor 并折断(在我的情况下,错误与啪啪声有关,我认为您不必在您的情况下删除它(

sudo apt-get purge apparmor
sudo apt-get purge apparmor-profiles
sudo apt-get purge apparmor-utils
sudo apt-get remove snapd snapd-confine

现在将它们全部安装回来(同样,您可能不需要安装 snapd(:

sudo apt-get install apparmor-utils
sudo apt install apparmor-profiles apparmor-profiles-extra vim-addon-manager
sudo apt install snapd snapd-login-service snap-confine 

相关内容

  • 没有找到相关文章

最新更新