原文网址:http://my.opera.com/djfake/blog/2011/11/05/ubuntu-11-10-mysql-problem-after-upgrade
Ubuntu 11.10 mysql problem after upgrade
Saturday, November 5, 2011 12:35:18 AM
If you find that mysql doesn't run after upgrading to 11.10, it could an issue with the fact that /var/run was replaced with /run.
Check /var/log/mysql/error.log, and you'll find something like this:
Or if you try to login to mysql, you'll get this:
Well, here's the fix! Go edit /etc/apparmor.d/usr.sbin.mysqld as root and replace
with
then
and viola! our mysql db's are back!
Check /var/log/mysql/error.log, and you'll find something like this:
111104 19:11:33 [Note] Plugin 'FEDERATED' is disabled. 111104 19:11:33 InnoDB: Initializing buffer pool, size = 8.0M 111104 19:11:33 InnoDB: Completed initialization of buffer pool 111104 19:11:34 InnoDB: Started; log sequence number 0 44233 111104 19:11:34 [ERROR] Can't start server : Bind on unix socket: Permission den ied 111104 19:11:34 [ERROR] Do you already have another mysqld server running on soc ket: /var/run/mysqld/mysqld.sock ? 111104 19:11:34 [ERROR] Aborting
Or if you try to login to mysql, you'll get this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Well, here's the fix! Go edit /etc/apparmor.d/usr.sbin.mysqld as root and replace
/var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w,
with
/{,var/}run/mysqld/mysqld.pid w, /{,var/}run/mysqld/mysqld.sock w,
then
sudo service mysql restart
and viola! our mysql db's are back!