First, I installed mysql-server

Next, I did


I was going to add a database and edit some stuff.

But I got this error:

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

How do I fix this? Thanks for your time

Edit #1: I did this command:

$sudo service mysql start

And I got this back:

start: Unknown Job: mysql


  • try to go into sudo before logging in mysql. Also look at tutorials or use mysql --help to se how to log into db.
    – piotrektt
    Jun 16, 2014 at 21:46

1 Answer 1


By default MySQL seems to only listen on a TCP socket, rather than a unix domain socket.

Your client is trying to connect to the server over the (faster) domain socket.

You need to enable the unix socket like so:

Edit the file:


Uncomment the line:

socket = /var/run/mysqld/mysqld.sock

Then run:

service mysql restart

  • Just to be sure, do we uncomment be doing something like /this is an uncommented line/
    – user287210
    Jun 19, 2014 at 15:34
  • I keep on getting more errors, like "/usr/bin/service: 127: /usr/bin/service stop: not found
    – user287210
    Jun 19, 2014 at 15:41

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.