I'm trying to get a lamp server running on my ubuntu installation. I have SSH and Apache working without any problems.

I installed MySQL with sudo apt-get install mysql-server mysql-client

As usual with proir installations i've done it asked for a password. And looked like everything was fine. Except when i tried to test it out. mysql -u root -p Error Can't connect to local mysql server through socket /var/run/mysqld/mysqld.sock

I went to the file location and there was no mysqld.sock file. I googled around for a while, and one response was to restart via /etc/init.d/mysqld restart.

there's no mysqld file in my init.d folder either!!?? What's going on here? Any suggestions? How can i install and reinstall mysql? Is there some reason that the mysql service isn't installing?


1 Answer 1


The file is called


not mysqld.

You can use also

sudo service mysql restart

Check afterwards if MySQL is running: you can use e.g. top or htop or run ps -aux|grep mysql.

  • Yeah, messed up on the question. It's a fresh install of mysql. service mysql start works okay, but mysql doesn't start. grep returns root 7008 5892 0 14:19 pts/1 00:00:00 grep --color=auto mysql and mysql -u root -p returns ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Oct 22, 2012 at 13:20
  • Please did you put any password for your MySQL user? Feb 8, 2018 at 17:55

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.