When I try to connect to MySQL, I get the following error:

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

It seems like this is a common error as I googled it and found a lot of responses. I tried a lot of the responses to fix it and here are the various error messages I receive:

When running service mysql start:

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"))

When running 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.

When running ps -ef | grep mysql:

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

I've tried purging MySQL and reinstalling it but I get the same errors every time.

Everything was working fine but I upgraded the Ubuntu Server software and things don't work anymore.

2 Answers 2


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

invoke-rc.d mysql start


Check your MySQL datadir permission.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.