I'm having problem with this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

It appears every few minutes but after few seconds everything is ok...

Have you guys any solution for that?

migrated from stackoverflow.com Aug 5 '11 at 3:49

This question came from our site for professional and enthusiast programmers.

  • Version? Access method? (C, JDBC, ...) – Ondra Žižka Aug 5 '11 at 2:55

I think in the error message the number 2 in parentheses is errno: No such file or directory

Who is removing the socket? I would find that out with with Linux audit facility. It is very helpful when diagnosing problems such as this.

Edited to add: Is your mysqld server process dying for some reason? It might remove the socket if it dies. Then the wrapper script re-starts the mysqld process and the socket gets re-created.


Perhaps connection pool's connection timed out? Or maybe too many connections?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.