无法在ubuntu 11上安装mysql

时间:2012-04-02 07:47:48

标签: mysql ubuntu

我想在我的Ubuntu 11.10中安装mysql。我在终端中使用sudo apt-get install mysql-server进行安装。

它给了我这个错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up mysql-server-5.1 (5.1.61-0ubuntu0.11.10.1) ...
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 9: Could not open 'abstractions/mysql'
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports has already been reached
                                                                    dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.1; however:
  Package mysql-server-5.1 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    Errors were encountered while processing:
 mysql-server-5.1
 mysql-server

谁能告诉我这里发生了什么?我该如何解决这个问题?

由于

4 个答案:

答案 0 :(得分:11)

尝试删除apparmor包:

sudo apt-get remove apparmor 

然后使用mysql-common软件包重新尝试安装:

sudo apt-get install mysql-common mysql-server

答案 1 :(得分:4)

鉴于以下情况,它肯定会奏效。我绞尽脑汁待了好几个小时,这终于有了帮助:

  1. dpkg --remove mysql-server-5.5

    或只是

    dpkg --remove mysql-server

  2. sudo apt-get purge -f mysql-server mysql-common

  3. sudo apt-get install mysql-server mysql-common

答案 2 :(得分:1)

我收到了错误“

  

ERROR 2002(HY000):无法通过套接字'/var/run/mysqld/mysqld.sock'连接本地MySQL服务器(111)“

我这样做了 http://hunt4.biz/wordpress/?p=25

$ mysqld

重新启动后打开shell并输入以下内容:

1. ~$ sudo mysqld &
2. ~$ ps -aux | grep mysqld

寻找类似的东西:

mysql    27035  0.0  0.7 180584 27412 ?        Ssl  08:41   0:05 /usr/sbin/mysqld
3. ~$ sudo kill -9  27035
4. ~$ sudo /etc/init.d/mysql start or sudo service mysql start

然后

sudo apt-get remove apparmor 

解决了我的问题。

答案 3 :(得分:0)

我必须删除(作为超级用户)我的/ var / lib / mysql文件夹。在我这样做之前,我反复尝试了上述解决方案(不同的排列),但没有成功。 FYI。