mySQL Error : Can’t connect to local MySQL server through socket

Being a noob when it comes to setting up a Linux development environment I decided I would get some practice in and set up a new LAMP stack. Well all went swimmingly until I tried to connect to mySQL server. I could not work out what was going on as I kept getting a ‘ERROR 2002 (HY000): Can’t connect to local MySQL server through socket‘ error. I re-installed mySQL and tried again and same thing. I was beating my head against the wall trying to figure this out. So after I did work it out, I felt really sheepish and decided I would save some one else the embarassment!

To fix the error ERROR 2002 (HY000): Can’t connect to local MySQL server through socket type this simple command

/etc/init.s/mysqld start‘ (provided you are using Red Hat/Centos, location may vary according to distro)

Yip, I was stupid enough to not start the server after I had installed it. So if you get stuck, dony admit it to anyone, just type in the easy mysql start command!

Share

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.