I am trying to connect HeidiSql from the host to my WSL Mysql but I could not get it to connect it
Error "can't connect to Mysql server on '127.0.0.1'"
Tried SSH too but could not connect to the server
I am trying to connect HeidiSql from the host to my WSL Mysql but I could not get it to connect it
Error "can't connect to Mysql server on '127.0.0.1'"
Tried SSH too but could not connect to the server
Since your question is asked before WSL2 release, So I assume you were using WSL1, for WSL1 you can access WSL1 MySQL directly from windows, but you were access in a wrong way, in the NetWork type
, you should choose MariaDb or MySQL(TCP/IP)
instead of MySQL (SSH Tunnel)
For WSL2 check this WSL github issue, save @edwindijas's powershell script and execute it by administrator, you may still can not access MySQL , and got access denied for user ... <you-computer-name>.mshome.net
, you need to allow this user access it from this host
, let's say root, you need execute this in mysql cli:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%<you-computer-name>.mshome.net' IDENTIFIED BY '<password>';
Or allow root user access WSL2 MySQL from any host:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
As for me who's also using WSL for making web based application
first make sure mysql is running on WSL like sudo service mysql start
then once started, open HeidiSql and simply connect to it, here the example on my part
make sure the IP address is 127.0.0.1 not any IP, not your IP used to connect on the internet
I'm also hosting mysql-server on WSL and running MySQL workbench on Windows.
I had to get the IP inside of WSL
And use this IP in MySQL Workbench