Home > database >  Unable to access my off site MYSQL DB via a VSCode extension when it is running under WSL2
Unable to access my off site MYSQL DB via a VSCode extension when it is running under WSL2

Time:12-17

I'm running Windows 11. I have my dev environment in Debian running via WSL2.

I have this VSCode extension installed (although I have tried multiple SQL VSCode extensions and they all act the same)

If I have a VSCode window open in a WSL2 instance I am unable to connect to my DB but if I have a normal VSCode window open I am able to use any extension to access my DB.

In both instances the DB connection details are identical.

I need to use a program called ScaleFT to create a secure tunnel to the DB, I'm assuming this is the cause of the issue in part.

I am able to connect to my local dev MYSQL DB running in docker from both a WSL and normal VSCode window.

CodePudding user response:

I've found that WSL's network sharing with the host system seems to run into trouble a lot with VPN and Ad-Hoc tunnel sharing with the Windows host.

What worked best for me was just to install an independent client for the WSL host. I use Ubuntu personally but I bet this will be a drop-in for your Debian setup, too.

Add the ScaleFT Repo to apt:

echo "deb http://pkg.scaleft.com/deb linux main" | sudo tee -a /etc/apt/sources.list

Add the ScaleFT signing keys to your local keyring:

curl -fsSL https://dist.scaleft.com/pki/scaleft_deb_key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/scaleft-deb-key.gpg

Pull package list and install the Linux tools:

sudo apt update && sudo apt install -y scaleft-client-tools scaleft-url-handler

That should leave you with a ready copy of the sft client tool. You can test with:

sft --version

From there, you can enroll your new WSL client and those connections should start working for you but, of course, your mileage may vary!

  • Related