Creating an ssh tunnel for mysql


ssh -N -f -L 3307:localhost:3306 user@myxhost.com
ssh -L 3307:localhost:3306 user@myxhost.com

-f = go to background
-L = local port to remote port binding
-N = no remote command to be executed

test with either of the following:

mysql -P 3307 -u dbuser -h 127.0.0.1 -p
mysql -P 3307 -u dbuser --protocol=TCP -p

tunnel can be closed with ps -ef | grep ssh and then kill the pid

http://www.webmasterworld.com/forum40/1010.htm

http://support.suso.com/supki/SSH_Tutorial_for_Linux

for windows:
http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html
some more stuff, but there is a mistake in setting up the tunnel in putty (need to use 127.0.0.1)
http://www.tech-recipes.com/rx/6194/windows-xp-vista-win7-setup-a-secure...

SSH (PLINK and PuTTY) Info/Tips for Metawerx Customers - v1.2