vscode-mysql icon indicating copy to clipboard operation
vscode-mysql copied to clipboard

FR: SSH Tunnel Support

Open st-schneider opened this issue 7 years ago • 15 comments

It would be great if I could use the extension with an ssh tunnel to vagrant.

st-schneider avatar Nov 23 '17 09:11 st-schneider

Hi @bm-stschneider , could you share more details about how you want to connect MySQL with SSH tunnel. I am not familiar with that, but I find there is a solution to make you able to connect MySQL through general connection option: https://stackoverflow.com/a/18374012/4545351.

formulahendry avatar Nov 23 '17 12:11 formulahendry

Just like here where you can configure the tunnel in the connection setting.

image

st-schneider avatar Nov 23 '17 12:11 st-schneider

Got that. Thanks for the detailed info.

formulahendry avatar Nov 23 '17 12:11 formulahendry

I'd love this too

ifish12 avatar Nov 27 '17 14:11 ifish12

yep. in mysql workbench and in many other tools it exist.

The perfect set would be to use the native ssh client instead a reimplementation (so if you use a key, the ssh agent will open it for you), if possible

Grummfy avatar Dec 28 '17 13:12 Grummfy

Would this help: https://www.npmjs.com/package/ssh2 ?

Used by https://github.com/liximomo/vscode-sftp/ whick works really well in VSCode on both Linux and Windows (not tried Mac OS)

jeremypoulter avatar Apr 12 '18 19:04 jeremypoulter

In the meantime you can just setup an ssh tunnel manually. Open a terminal and

ssh -N -L 3306:127.0.0.1:3306 ssh-user@remoteserver

And put 127.0.0.1 as address in the connection profile.

EDIT: Sorry for the duplicate .. just saw this solution has been added as a second post.

schuster-rainer avatar Jun 07 '18 08:06 schuster-rainer

Any progress for this FR?

st-schneider avatar Dec 07 '18 07:12 st-schneider

Agree, would have me switching from MySQL Workbench and DBeaver.

range-of-motion avatar Apr 11 '19 07:04 range-of-motion

This case hasn't been updated in a while. I'm running into a related problem while trying to get tunneling to work. I have an ssh proxy via command line that works (successful mysql connection):

$ ssh <proxy-username>@<proxy-host> -L 3306:<db-host>:3306 -N
$ mysql -h 127.0.0.1 -u <db-username> -p

but when I try to use this extension with 127.0.0.1 and my db-username, it comes back with Error: ER_ACCESS_DENIED_ERROR: Access denied for user '<db-username>'@'<proxy-host-ip>' (using password: YES

So it looks like the tool is doing some kind of ip lookup instead of passing the params directly. Any ideas/help?

rswhiting avatar Nov 06 '19 17:11 rswhiting

Will using this package help?

https://www.npmjs.com/package/mysql-ssh

jayaramkasi avatar Feb 04 '20 04:02 jayaramkasi

My fork is support ssh tunnel https://github.com/cweijan/vscode-mysql

cweijan avatar Apr 30 '20 16:04 cweijan

@cweijan Cool, can you publish it on the marketplace then?

st-schneider avatar May 01 '20 11:05 st-schneider

@bm-stschneider https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-client it's published.

cweijan avatar May 02 '20 06:05 cweijan

Is this still a WIP? I could see that the current version has the toggle for SSH tunnel and inputs but it is not able to read my private key.

image

I see the below error when connecting. The same private key and config works perfectly for Mysql Workbench.

image

ParkourKarthik avatar Jun 22 '21 13:06 ParkourKarthik