15 March 2019

SSH tunneling is routing local network traffic through SSH to remote hosts. Can be used, for example, to connect to the remote application that was bound on remote local port.

For example, to connect to mysql instance that was bound on remote local port 3306 you can use:

ssh -L 3366:localhost:3306 [USERNAME]@remotehost.com

or if you would like to connect with SSH keys :

ssh -i [KEY_FILENAME] -L 3366:localhost:3306 [USERNAME]@remotehost.com

After you can connect to the database, using your favorite tool on localhost:3366