![Mysql 服务拒绝启动-/sys/devices/system/cpu/ 读取失败](https://linux22.com/image/1323571/Mysql%20%E6%9C%8D%E5%8A%A1%E6%8B%92%E7%BB%9D%E5%90%AF%E5%8A%A8-%2Fsys%2Fdevices%2Fsystem%2Fcpu%2F%20%E8%AF%BB%E5%8F%96%E5%A4%B1%E8%B4%A5.png)
mysqld 服务拒绝启动。
sudo service mysql start
请参阅下面的列表。跑步mysql_upgrade
没有帮助。
我发现一些论坛帖子说这是在 Ubuntu 升级后发生的,但没有找到解决办法。
有人知道该怎么解决吗?谢谢。
更新:已尝试
sudo nano /etc/apparmor.d/usr.sbin.mysqld
并添加/sys/devices/system/cpu/
。没有帮助。
更新 2:
继续使用:
$ cat /var/log/daemon.log
Jul 27 11:40:06 ondra-redhat /etc/init.d/mysql[1497]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Jul 27 11:40:06 ondra-redhat /etc/init.d/mysql[1497]: /etc/init.d/mysql: line 75: /usr/bin/mysqladmin: File doesn't exist.
$ sudo apt-get install mysql-client-5.1
...
现在它是:
Jul 27 12:04:50 ondra-redhat /etc/init.d/mysql[5913]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Jul 27 12:04:50 ondra-redhat /etc/init.d/mysql[5913]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
Jul 27 12:04:50 ondra-redhat /etc/init.d/mysql[5913]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jul 27 12:04:50 ondra-redhat /etc/init.d/mysql[5913]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
[8589966.601336] type=1400 audit(1343380526.258:9082): apparmor="DENIED" operation="open" parent=308 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=309 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589966.708033] type=1400 audit(1343380526.362:9083): apparmor="DENIED" operation="open" parent=327 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=328 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589967.768430] type=1400 audit(1343380527.426:9084): apparmor="DENIED" operation="open" parent=340 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=341 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589968.776121] type=1400 audit(1343380528.430:9085): apparmor="DENIED" operation="open" parent=350 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=351 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589969.784022] type=1400 audit(1343380529.438:9086): apparmor="DENIED" operation="open" parent=362 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=363 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589970.791553] type=1400 audit(1343380530.446:9087): apparmor="DENIED" operation="open" parent=372 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=373 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589971.799176] type=1400 audit(1343380531.454:9088): apparmor="DENIED" operation="open" parent=384 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=385 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589972.807000] type=1400 audit(1343380532.462:9089): apparmor="DENIED" operation="open" parent=394 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=395 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589973.814536] type=1400 audit(1343380533.470:9090): apparmor="DENIED" operation="open" parent=405 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=406 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589974.822025] type=1400 audit(1343380534.482:9091): apparmor="DENIED" operation="open" parent=416 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=417 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589975.829509] type=1400 audit(1343380535.486:9092): apparmor="DENIED" operation="open" parent=426 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589976.837076] type=1400 audit(1343380536.494:9093): apparmor="DENIED" operation="open" parent=436 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=437 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589977.844707] type=1400 audit(1343380537.502:9094): apparmor="DENIED" operation="open" parent=446 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=447 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589978.852981] type=1400 audit(1343380538.510:9095): apparmor="DENIED" operation="open" parent=456 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=457 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589979.860772] type=1400 audit(1343380539.518:9096): apparmor="DENIED" operation="open" parent=466 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=467 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589980.868339] type=1400 audit(1343380540.522:9097): apparmor="DENIED" operation="open" parent=476 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=477 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[8589980.875425] type=1400 audit(1343380540.530:9098): apparmor="DENIED" operation="open" parent=485 profile="/usr/sbin/mysqld" name="/sys/devices/system/cpu/" pid=486 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
$ sudo mysql_upgrade -p --force
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock'
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock'
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
mysql.user_info OK
test.payments OK
test.users OK
Running 'mysql_fix_privilege_tables'...
OK
答案1
解决了。我安装了 mysql-server-core-5.1,但 apparmor 配置在 mysql-server 元包中。sudo apt-get install mysql-server
更新/etc/apparmor.d/usr.sbin.mysqld
后它开始工作了。