WSL 2 Accessing Services Running on Windows
1 min readOct 16, 2019
So I took the jump, updated to Windows Insider Fast Ring to allow me to access WSL 2. (what a difference compared to WSL 1) It runs fast rings around WSL 1.
I had one issue I could not connect to the MySql instance I have running on Windows. WSL 2 changed the network from bridged to NAT, so to connect I had to use my local network address.
Happy days until you change network and get a new ip…
My solution/hack:
part 1: Get IP address on windows and pass to bash script
part 2: Update host file on WSL 2
part 3: Allow script to be run without password
part 4: Schedule with TaskScheduler every time you login
part 5: profit