If you are having problems connecting through socket, you may try connecting to your mysql server via tcp:
mysql -h localhost
Or using username/password:
mysql -h localhost -u root -p
Either one may work depending on how the users are set up. If you get this error it means that the mysql command is at least talking to the server:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Check the permissions on those directories or that the file was in use.
Here's a permission scenario. Suppose that you install MySQL and are playing around as root, you manage to start the database and accidentally get it to write in the /tmp directory a named socket with root ownership. You kill the process in a violent way and cleanup doesn't happen.
Then, later, you try as a regular user to get MySQL to start, which may want to use a special mysql user the distro put on your system. Because the named socket exists, it fails. Because it doesn't have permission to zap root's cruft, that fails.
Then you reboot, which can wipe all of /tmp before the system starts. Now there's nothing there, the MySQL server comes up, no conflicts, and magically it all appears to work.
Not saying this is what happened, but most of my woes when something happened like this turned out that some directory didn't have write permission along the way or the file was already there and couldn't be deleted by a mortal account.
Glad to hear you got it fixed, though.
Best Answer
Go to your most recent backups and restore all the files. And. if you don't have a recent backup, why the blazes not?
Assuming you can get the information back using what will undoubtedly be some good answers here, institute a backup policy!. Disk space is ridiculously cheap.
Marked CW since it doesn't answer your specific problem but it is useful, mark my words. Anyone who reads this answer and doesn't back up their stuff in a timely manner, take heed, you will get burnt (and, if it's your digital photo collection of wife and kids from the last ten years, your wife will have every right to castrate you while you sleep).
If this happens to you again, you deserve all the angst you'll get and I will openly mock and deride you :-)