I have a MySQL server sitting behind a bastion server that I wish to connect to from my local machine.
Ideally I want to port-forward the MySQL port (3316 in this case) to a local port on my machine.
I've tried plink -ssh -L 3306:my.sql.ip.address:3316 my.bastion.server
,but this is not working.
I've got one ssh login for the bastion server and another login for the machine mysql server is running on.
Best Answer
You can double-chain SSH port forwards, bit a slightly easier method is to set up a "proxy" config in
.ssh/config
:Then use
ssh -L 3306:127.0.0.1:3316 final-user@final.host%proxy
to bring up the seesion.I use this all the time, although normally with dyanamic port forwards (
-D 1080
) to get to management modules of hosts behind overly restrictive firewalls.