-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to connect from bash to mysql (or other network services) installed in Windows? #737
Comments
How are you trying to connect? over a socket? Can you use the template and send us full repro details? |
in bash shell i am trying this
and got error
but now i try this
and it work for me. i can use mysql server installed on windows. but only by IP |
This is an issue in the MySQL client implementation. It automatically overrides a host set to |
@Marlinc Wow, and you can't even set it like "tcp,localhost" or anything? |
@fpqc : I don't think the MySQL developers envisioned an environment like WSL so segregated from MySQL running as a service in Windows. But WSL is so segregated, I would automatically assume I'd need to connect via IP rather than unix socket. Or, perhaps, figure out if the Windows service supports sockets (doubtful), and tell the mysql client in WSL where to find the socket. The default for the client is probably /var/run/mysqld/mysqld.sock which would be in VolFS, and windows programs are supposed to stay away from that. If MySQL running in Windows does listen on a socket (a socket compatible with WSL?), it would definitely be somewhere else (in DriveFS?). The MySQL client supports an option file, where one can probably specify protocol and ip address and port and such to use for a given server. So if explicitly saying (on the command line) --protocol=TCP doesn't force --host=localhost to use TCP/IP, one can probably use some combination in an option file to force it to use the right settings, without having to remember (and type accurately) all the options each time. |
Have just installed mariadb and had same issue and after restrating the mysql service it worked. |
That is not a bug, is actually documented in mysql. Those parameters are ignored unless you add --protocol=TCP |
Ok, but in mysql there is a file caled my.cnf or similar. These option annot be set in this file? I searched but I have not found my.cnf, but I'm sure there is... |
Using '127.0.0.1' instead of localhost, resolved the issue, think this is easy to do when connecting from a php script rather than defining the protocol. http://stackoverflow.com/questions/6366192/specifying-protocol-in-mysql-connect-php |
As suggested @ricksanchez I had to add After that, I was able to connect to a XAMPP powered mysql instance from WSL. In my app living in WSL, changing the host from localhost to |
i want to know if i can use XAMPP for laravel |
This should work. In my case, port is 3306 mysql -u root -p --host=127.0.0.1 --port=3306 --protocol=TCP |
I got the same problem but none of your suggestions works... not even with port and protocol. Can easily connect through Workbench installed on the Windows but not from WSL. Im using a Mysql8.0. I downgraded to WSL 1 then it worked. Is this not supported in WSL2 ? |
I installed MySQL (Maria) via WAMP and used apt install mariadb-client-core-10.3 to get WSL 2 to recognize the mysql command, then used |
Please tell me how to add our MySQL code from git bash to GitHub. And we need to download the MySQL code somewhere, guys please help I am confused. |
I am try to connecting from bash mysql client to mysql server installed in windows
but it not work.
How to work with mysql (or mssql or other databases) and other windows network services from this bash ubuntu?
The text was updated successfully, but these errors were encountered: