MySQLdb + SSH Tunnel

Emile van Sebille emile at fenx.com
Sun Jul 12 21:41:31 CEST 2009


On 7/12/2009 12:18 PM Riley Crane said...
> OVERVIEW:
> I am running a script on one machine that connects to a MySQL database
> on another machine that is outside of our university's domain.
> According to the administrator, network policies do not allow the
> compute nodes to access machines outside of our university's domain.
> 
> COMPUTERS:
> A = compute node within university (I do not have shell access)
> B = 2nd machine within university that does not block outside
> connections (I have root access)

...so B can talk to C presumably...

> C = machine outside of university (I have root access)
> mysqldb on A cannot connect to C ....but.....
> mysqldb on A can connect to B



> 
> WHAT I WOULD LIKE TO DO:
> Is it possible to set something up where A talks to a port on B, and
> that port is actually nothing more than 3306 on C?  Can I do this with
> an SSH tunnel?
> 
> Can anyone please give precise instructions?

ssh with something like...

ssh -lroot -L3306:C:3306 B

Watch out for other instances of mysql on A or B...

Emile





More information about the Python-list mailing list