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

Cha0s posted 7 years ago in General
I've been trying for some time to connect to a MySQL server that listens only on loopback ( 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:

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: -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 posted 7 years ago
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.
Cha0s posted 7 years ago
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.
ansgar posted 7 years ago
Haha, nice workaround. Somehow old-stylish and most effective.

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