I just installed MySQL 5.5.27 on WinXP. When I open a command prompt (Start -> Run, and type “cmd”), I can access MySQL by running “mysql -u root -p”. However, when I open a Cygwin terminal and try the same thing, I get this error
$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql.sock' (2)
Indeed, there is no “/var/run/mysql.sock” file.
If you specify the host on the command line, this issue should go away:
You can also create a
my.inithat mysql will use:Then you can just type:
You can even add the password:
Then, just type:
and you’re in!
See also https://serverfault.com/questions/337818/how-to-force-mysql-to-connect-by-tcp-instead-of-a-unix-socket