SSH tunneled connection to a MySQL server
Nice write up on MySQL and SSH, practically anything that you can connect to can be tunneled over SSH.
To set up a tunneled connection to a MySQL server at remotehost.com, you can issue the following two commands on any client:ssh -fNg -L 3307:127.0.0.1:3306 myuser@remotehost.com
mysql -h 127.0.0.1 -P 3307 -u dbuser -p dbThe first command tells ssh to log in to remotehost.com as myuser, go into the background (-f) and not execute any remote command (-N), and set up port-forwarding (-L localport:localhost:remoteport ). In this case, we forward port 3307 on localhost to port 3306 on remotehost.com.
0 TrackBacks
Listed below are links to blogs that reference this entry: SSH tunneled connection to a MySQL server.
TrackBack URL for this entry: http://kennethhunt.com/mt/mt-tb.cgi/1875