MySQL Remote Access (using SSH tunnel)

This brief article describes how to use an SSH tunnel (http://www.ssh.com/support/documentation/online/ssh/adminguide/32/Port_Forwarding.html) to connect to your MySQL database.

Open a Terminal (or Putty in Windows)

$ ssh -L 3307:127.0.0.1:4168 w_pfjcd@dev2.webenabled.net
Password: <enter the password and leave the login open>

You will need to change w_pfjcd and 4168 to the right values. The MySQL port and password are in ~/.my.cnf on your vhost. Make sure to user 127.0.0.1 and not localhost. Also change dev2 to the appropriate machine your application is hosted on.

Open another terminal

$ mysql -u w_pfjcd -h 127.0.0.1 -P 3307 -p

Once you confirm this works then you should be able to enter the same values from the mysql command into the Query Browser settings or any other local database tool that you prefer to use.

Here are a couple debug commands:

$ netstat -an | grep 3307
$ telnet localhost 3307

More info

http://www.howtogeek.com/howto/ubuntu/access-your-mysql-server-remotely-over-ssh/