Archive for the tag 'tunnel'

SBDavid

Setting up the Tunnel for MySql

Setting up the Tunnel

The most common methods of setting up a tunnel are through putty or through command-line SSH.

To open an SSH tunnel via the command line, run:

ssh -L3307:127.0.0.1:3306 -p 22 -N -t -x user@myhost.com

Connecting with MySQL

You can connect to the MySQL server!
You want to choose 3307 for your local port so that it does not conflict with your existing local copy of MySQL.

mysql -u username -ppassword -h 127.0.0.1 -P 3307

SBDavid

SSH tunnel for Mysql

SSH tunnel for Mysql

This will open a tunnel, listening on localhost:3308 and forwarding everything to yourdomain.com:3306

ssh -L 3308:yourdomain.com:3306 username@yourdomain.com

And then

mysql -u username -p -h 127.0.0.1 -P 3308 databasename