Nathan
Nathan

Reputation: 3195

Connecting to MySQL through Cygwin

I have XAMPP running on my desktop and can connect to the MySQL server via phpMyAdmin. However, when I try to connect through Cygwin:

Error: Can't connect to local MySQL server through socket '/var/run/mysql.sock' (2)

I've tried connecting to MySQL on the same machine, my local dev server and my remote server, all failed.

Upvotes: 6

Views: 6203

Answers (2)

Neal Garrett
Neal Garrett

Reputation: 185

you can also add the alias of itself.

alias mysql = 'mysql -u {user} -p{password} -h 127.0.0.1'

Upvotes: -3

Moreno Garcia
Moreno Garcia

Reputation: 156

mysql -h 127.0.0.1 -P <PORT> -u root -p

This is what worked for me. Make sure you check what is the correct port.

Check the mysqld PID with:

ps -sW | grep mysqld

And then find the PORT with:

netstat -nao | grep <PID>

Have fun!

Upvotes: 14

Related Questions