in reply to Tunneling DBD::mysql connections over SSH without using external programs
This is not a Perl solution, but if the remote end has an ssh daemon running, you can use SSH tunneling to connect to the remote database:
ssh -fNg -L 6603:127.0.0.1:3306 remote_user@mysql.example.com
Then you connecto to localhost:6603, and the communication should get forwarded to the remote machine.
To do this transparently from Perl, I would launch ssh in the background like this:
my $ssh_pid= open("ssh -fNg -L 6603:127.0.0.1:3306 remote_user@mysql.e +xample.com |") or die; my $dbh= DBI->connect("dbd:mysql..."); ... # tear down the connection kill -9 => $ssh_pid;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tunneling DBD::mysql connections over SSH without using external programs
by wwinfrey (Acolyte) on Apr 11, 2013 at 21:30 UTC | |
by salva (Canon) on Apr 12, 2013 at 08:16 UTC | |
by wwinfrey (Acolyte) on Apr 12, 2013 at 15:52 UTC | |
by salva (Canon) on Apr 12, 2013 at 21:16 UTC |