Creating an ssh tunnel for mysql

ssh -N -f -L 3307:localhost:3306
ssh -L 3307:localhost:3306

-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 -p
mysql -P 3307 -u dbuser --protocol=TCP -p

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

for windows:
some more stuff, but there is a mistake in setting up the tunnel in putty (need to use

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