I got this error message when I start mysql.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

I just installed installed apache2 and mysql. Whenever I type mysql and hit enter I get above message. I'm on CentOS 6.

When I run whereis mysql I get:


And when I restart the service mysqld restart I get an "unrecognized service" error.

  • Hello sankae, welcome to SU. This question is without enough detail to be able to help. Please edit and describe more about what you have done and what errors or issues you are facing. – Paul Dec 20 '12 at 10:57
  • What OS are you on and what version of mysql and apache2 have you got installed? We resolved a similar issue by updating all packages. – xylar Dec 20 '12 at 11:08
  • check if mysql is not running already or if port 3306 is not taken. use ps aux | grep mysql and netstat -patn to view those details – mnmnc Dec 20 '12 at 11:09
  • to start mysql you shouldn't just type mysql start or mysql nor mysqld. Please use service mysql start to start the service. – mnmnc Dec 20 '12 at 11:11
  • what happens when you type in whereis mysql which mysql ls /usr/sbin/ | grep mysql ? Have you tried restarting the server after mysql installation? – mnmnc Dec 20 '12 at 11:20

Your Answer

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

Browse other questions tagged or ask your own question.