Tunneling MySQL through SSH in background
September 18, 2009 at 11:52 pm Leave a comment
If you want to access a database where you don’t have remote access privilege you must set up a ssh tunnel to your remote server.
Command format:
ssh -f -N -L localport:127.0.0.1:destination.port username@ssh_server.ip
Command example:
ssh -f -N -L 3307:127.0.0.1:3306 spocko@rutgers.edu
Set the port to 3307 so that it does not clash with your local mysql.
Then to test access to database:
mysql -h127.0.0.1 -u spocko -p -P3307
Entry filed under: Uncategorized. Tags: .
Trackback this post | Subscribe to the comments via RSS Feed