SSH Tunnel with plink.exe - Wrong plink.exe syntax

[expired user #5216]'s profile image [expired user #5216] posted 14 years ago in General Permalink
I've been trying for some time to connect to a MySQL server that listens only on loopback (127.0.0.1) via an SSH Tunnel.

Whatever settings I tried an error occured.

The error was:
PLink exited unexpected. Command line was:
C:\Program Files\HeidiSQL\plink.exe root@hostname -pw my password -P 22 -L 3307:127.0.0.1:3306

I tried running the above command myself to see that error it returns and as it seems, the above syntax is wrong according to plink.exe help.

The correct syntax which connected successfully to the server was:
plink.exe -P 22 -L 3307:127.0.0.1:3306 -pw "my password" root@hostname

Notice the double quotes enclosing the password.
In my case my password had spaces so it's needed to be enclosed with double quotes.

Also the root@hostname must be in the end of the command.

C:\Program Files\HeidiSQL>plink.exe
PuTTY Link: command-line connection utility
Release 0.60
Usage: plink [options] [user@]host [command]


Is there a way to change the plink.exe syntax from heidisql so I can connect via SSH to the MySQL Server?


Thank you.
ansgar's profile image ansgar posted 14 years ago Permalink
I can surely add quoted around the password, which should fix your problem. While I don't think root@host must be the last parameter - that would mean this feature would not work for any user which is not the case.
[expired user #5216]'s profile image [expired user #5216] posted 14 years ago Permalink
Actually you are right! My bad about the syntax.

I tried via cmd to run it and I must have written something wrong leading me to believe that the user@host is strictly after the options.

I re-tried it now and it worked ok.
Also I wrote the my password with quotes in the password field and it worked ok.

So until there is a fix on the password field I can use HeidiSQL via SSH Tunnel this way :)


Thank you for your time.
Regards,
Vaggelis.
ansgar's profile image ansgar posted 14 years ago Permalink
Haha, nice workaround. Somehow old-stylish and most effective.
[expired user #11065]'s profile image [expired user #11065] posted 6 years ago Permalink

Hello, I just started using HeidiSQL. First, thanks for this product. I can connect from Windows 10 to SQL2017 on Centos. I did this at first by opening putty and it connected me immediately. UI looks great. I can't connect with Microsoft's own management tool so this is a life saver. I am trying to set up plink.exe using the setting under MySQL. I get this error message:

PLink exited unexpected. Command line was: C:\Users\jeb6\Downloads\MyDownloads\Putty\putty\PLINK.EXE -ssh jeb6@127.0.0.1 -pw "**" -P 1855 -N -L 3307:127.0.0.1:3306

Any ideas on this? I can use putty, but this would eliminate that step.
Thanks,

Joe Bigler

Please login to leave a reply, or register at first.