After Debian upgrade I got an ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Hi fellows,

I upgrade from Debian 8 to Debian 9 and everything ran smoothly, except for MySQL, I am getting this error:

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

I look for the socket in the cnf file and even create the folder, give permissions over the file, but still nothing. I can see is installed, but is not running. I tried to manually start it but nothing happen and I got nothing in console.

Anyone can give me a hand here?

2 Replies

Thank you for providing the exact error you were seeing, since that was helpful for me in looking into this for you. I did a Google search on the error that you provided and found the following post on StackOverflow:

error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' — Missing /var/run/mysqld/mysqld.sock

There are a number of approaches offered as solutions, which I would recommend reading over them before running any commands. Some of the advice included there suggests this could be from multiple installations of MySQL or because the service may not have been started.

I'd also recommend reviewing our guide for Troubleshooting Web Servers, Databases, and Other Services , as this provides some additional context to some of the steps provided in the StackOverflow post.

You need to start your MySQL server again:

$ sudo service mysql start

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct