升级的Ubuntu,无法连接到MySQL服务器

当我尝试连接到MySQL时,出现以下错误:

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

这似乎是一个常见的错误,因为我GOOGLE了,发现了很多的答复。 我尝试了很多的反应来解决它,这里是我收到的各种错误消息:

当运行服务mysql启动时:

 start: Rejected send message, 1 matched rules; type="method_call", sender=":1.10" (uid=1002 pid=5788 comm="start) interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")) 

当运行mysqld -P 3305时:

 101115 11:06:02 [Warning] Can't create test file /var/lib/mysql/ubuntu.lower-test 101115 11:06:02 [Warning] Can't create test file /var/lib/mysql/ubuntu.lower-test 101115 11:06:02 [Note] Plugin 'FEDERATED' is disabled. mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 101115 11:06:02 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 101115 11:06:02 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name ./ibdata1 InnoDB: File operation call: 'open'. InnoDB: Cannot continue operation. 

运行ps -ef |时 grep mysql:

 victor 5809 5688 0 11:08 pts/0 00:00:00 grep --color=auto mysql 

我试过清除MySQL并重新安装它,但我每次都得到相同的错误。

一切工作正常,但我升级了Ubuntu服务器软件,事情不再工作。

cp /etc/mysql/my.cnf.dpkg-dist /etc/mysql/my.cnf

invoke-rc.d mysql start

检查你的MySQL的datadir权限。