Creating an SSH Tunnel

February 3, 2011

After some searching and trial-and-error, I came upon the following command to create an SSH tunnel.

ssh -L <local-port>:127.0.0.1:<remote-port> <user>@<remote-host>

Notes

I discovered using localhost instead of 127.0.0.1 can cause problems, especially with a remote MySQL server thinking it’s a local socket rather than TCP/IP connection.

comments powered by Disqus