On Wed, Jun 25, 2008 at 7:59 AM, Eric Lease Morgan <[log in to unmask]> wrote: > Is there anyway to support SSH tunneling through a MySQL DSN? > > I would like to open a database connection to remote host through Perl's > DBI. The remote database is MySQL, but the server hosting the database does > not allow outside connections. Instead the systems administrators suggest > first setting up a local SSH tunnel, and then making connections to the > host. Something this: > > $ ssh -T -L 3306:mysql.example.org:3306 [log in to unmask] & > $ mysql -h mysql.example.org > > Alas, this option does not work for two reasons. First, I get prompted for > my username after the first command and my shell crashes. Second, and more > importantly, port 3306 is already in use on my local machine. The whole > thing seems weird anyway. Yeah -- this is (probably) the way you want to do it, though. You'll need to: * Set up SSH keys such that building the tunnel doesn't prompt for a password * Run the local end of the tunnel on a free port * Configure your local client to talk to the local end of the tunnel Cheers, -Nate