Score:0

Using Putty/plink to connect to remote MySQL from Windows machine using Port Forwarding and multi hop SSH tunnel

kr flag

I need to set up port forwarding from my local Windows machine Port 3307 to a remote MySQL server port 3306 but accessed via 2 Linux proxy servers and a Linux web server.

I need to use Putty or plink.exe on the Windows machine to set up the connnection.

See diagram enter image description here

I've found examples using Putty GUI or plink CLI to achieve similar with only 1 proxy server but not with multiple hops.

I can achieve the connection I need on a *nix machine using
ssh -N -L 127.0.0.1:3307:db-server:3306 -J user@proxy1 user@proxy2 user@web-server

Trying to do the same using Putty or plink.

Update

I ended up using OpenSSH on Windows.

The final command was a little different to above.

ssh -L 127.0.0.1:3307:db-server:3306 -J user@proxy1,user@proxy2 user@web-server -p 31001 -i "C:\path\to\private-key"

Note we were connecting to the final web server on port 31001, hence the -p 31001.

Score:1
us flag

If there is no explicit requirement to use putty/plink, I would just use Windows built-in ssh for the purpose. It is the same SSH as in Unix.

Scott Anderson avatar
kr flag
I didn't realise! Going to try this.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.