…it could be because your network interfaces configuration has become messed up.
If you’ve a) just restarted your *nix server, and b) get an error like this when trying to fire up a MySQL process:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
you probably need to check that a loopback address exists.
If the results of an
ifconfig command don’t show an
lo interface, that’s why the MySQL process is falling over - by default, it listens on 127.0.0.1.
Add a new loopback interface with
ifconfig lo 127.0.0.1
and the MySQL process should then start normally.