gpt4 book ai didi

mysql服务没有正常重启

转载 作者:行者123 更新时间:2023-11-29 03:21:51 24 4
gpt4 key购买 nike

我在 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 应用程序文件

# 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

关于mysql服务没有正常重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42997729/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com