SSH proxy and MySQL on 3rd machine

view full story

http://serverfault.com – I would like to connect to a remote MySQL from my host, but the host is behind a ssh proxy, like this. I have 3 hosts in this problem A: my local machine (that can ssh to B) B: Intermediate machine that can SSH to C C: a remote server running MySQL and allows only connections from localhost (grant) I use ~/.ssh/config to allow me to ssh directly from A to C (using B as proxy). Host B ProtocolKeepAlives 30 HostName hostnameofB Host C ProtocolKeepAlives 30 ProxyCommand ssh -q B nc -q0 hostnameofC 22 LocalForward 3336 localhost:3306 Port 21343 I open a ssh from A (HowTos)