Ubuntu 11.04 - Unable to connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)

I have googled for 2 days and originally received

'/var/run/mysqld/mysqld.sock' (2) 

I fixed this using:

 sudo touch /var/run/mysqld/mysqld.sock sudo chown -R mysql /var/run/mysqld/ 

now I get the error message:

  '/var/run/mysqld/mysqld.sock' (13) 

So, everything has the correct permissions, and the file exists. Any thoughts?

[change]

It works for me, although I'm not sure how to do it. I made aa-logprof as root , nothing changed, got angry, and then installed again that it started working.

+7
source share
4 answers

You cannot (absolutely cannot) replace the pipe of the /var/run/mysqld/mysql.sock file system /var/run/mysqld/mysql.sock a regular file. You must use mkfifo(1) to create the pipe(7) that clients use to communicate with the mysql server.

(13) probably also means that you have a denial of access denial, EACCES (which usually has a decimal value of 13 - yes, I saw a lot of it).

If the file system permissions are configured correctly, you may have access denied by mandatory access control , such as AppArmor , SELinux , TOMOYO, or SMACK .

AppArmor is installed by default on Ubuntu devices and may deny access to the channel. The output of /var/log/syslog , /var/log/audit/audit.log or dmesg(1) for messages that look something like this:

 type=AVC msg=audit(1320723925.179:45115): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/ntop" name="/usr/share/ntop/html/PlotKit/excanvas.js" pid=1835 comm="ntop" requested_mask="r" denied_mask="r" fsuid=122 ouid=0 

(But instead of name=/var/run/mysqld/mysql.sock .)

If you have such error messages, run aa-logprof as root and answer the questions. More information on AppArmor configuration can be found in the apparmor.d(5) man page or some of the various wiki pages .

+5
source

In my case, starting mysqld_safe created a new mysqld.sock file.

 $ cd /etc/init.d/ $ mysqld_safe 

You probably won’t get the invitation back, but if you restart the session, the mysqld.sock file will be somewhere. Find it with

 $ sudo find / -type s | grep mysqld.sock 
+5
source

Have you checked if mysql server is running mysqld ? Also, check the system message log to see if anything is complaining.

0
source

Have you tried to delete the .lock file and restart mysqld?

0
source

All Articles