Thursday, May 15, 2008

Tunnel mysql through ssh

If you are looking to tunnel mysql through an ssh connection, use the following command on your desktop/client machine:

ssh -L 3307:localhost:3306 user@some.host.blah


Once established, you can connect to the remote mysql instance by connecting locally to port 3307.

This is useful when using a GUI application on a remote server where the MySQL port is closed off by firewall rules.

--Noel