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.
Enter mysql.exe -uroot -p , and MySQL will launch using the root user. MySQL will prompt you for your password. Enter the password from the user account you specified with the –u tag, and you'll connect to the MySQL server.
You can connect to a MySQL Server using the Database > Connect to Database… menu or click the + button that locates next to the MySQL Connections. Just click the + button in next to the MySQL Connections to continue.
And that’s it. MySQL on Cygwin is hardly server material, but it is good for practicing if you don’t want to set up a VM for the purpose.
MySQL is a well known database, which you will need if you plan on setting up a locally hosted site for web development, or similar. MariaDB, a fork of the project which came into existence after Oracle purchased MySQL, is not yet available on Cygwin as of 2015 or on Cygwin Ports, but watch this space.
Connect to MySQL Using MySQL Workbench. Step 1. Launch the MySQL Workbench. You can connect to a MySQL Server using the Database > Connect to Database… menu or click the + button that locates next to the MySQL Connections. Just click the + button in next to the MySQL Connections to continue. Step 2.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With