tunnelling mysql over ssh

Submitted by michael on Wed, 10/16/2013 - 23:42
Suppose you have a database server (db.example.com) which only accepts connections from the web server (www.example.com). The web server accepts SSH connections from anywhere (so ssh user@www.example.com works). And you have 200 tables to update. Start by opening a tunnelled SSH connection in a terminal window like so: [shell]ssh user@www.example.com -L 31123:db.example.com:3306 [/shell] The command starts like a normal ssh connection.

Mind blown

Submitted by michael on Tue, 05/14/2013 - 14:37
Grab a sudo shell and stay there: [shell]$ sudo -s [/shell]. So much nicer than [shell]$ sudo su[/shell] - it keeps all of your environment variables!