Skip to content

Instantly share code, notes, and snippets.

@ecarter
Created May 8, 2010 18:01
Show Gist options
  • Save ecarter/394684 to your computer and use it in GitHub Desktop.
Save ecarter/394684 to your computer and use it in GitHub Desktop.
Quick SSH tunnel for mysql connections for when you don't feel like add specific remote host access
### Quick SSH tunnel for mysql connection ###
# 3307 = local port to use
# mysqlserver = name/ip of mysql server
# 3306 = port number for remote mysql
# user@gateway = server you want to tunnel through
ssh -L 3307:mysqlserver:3306 user@gateway
# Now you can access remote mysql server locally by going to localhost
mysql -u user -p -h 127.0.0.1 -P 3307 dbname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment