No such file or directory - /tmp/mysql.sock
Here comes a maybe not so high level bit, but it nevertheless cost me a lost of time the other day to figure out what was going on.
Long story short - I am recently experimenting with ruby on rails and and kept getting the following error message each single time I wanted to scaffold any of my database tables:
No such file or directory - /tmp/mysql.sock
I am running Windows XP together with cygwin. Ruby is installed via cygwin and MySQL is installed via the MySQL windows installer.
It was pretty obvious ruby could not connect to my database, but I could not figure out why. The file mysql.sock did not exist on my system and I could not figure out how to get ruby to access the database via tcp/ip. Some people suggested adding port: 3306 to database.yml , but that did not change anything.
Then finally the breakthrough. I changed host: localhost in database.yml to host: 127.0.0.1 and everything worked like a charm. It turns out that when specifying localhost ruby tries to connect via a socket file whereas specifying a IP address switches to tcp/ip. Interesting.
So long,
--Hardy
Old comments
Note that if you specify localhost as a hostname, mysqladmin defaults to using a Unix socket file connection rather than TCP/IP. From MySQL 4.1 onward, you can explicitly specify the connection protocol to use by using the --protocol={TCP|SOCKET|PIPE|MEMORY} option.
See Running Multiple Servers on Unix
then my problem solved. hope this helps.