MySQLdb + SSH Tunnel
rileycrane at gmail.com
Tue Jul 14 05:12:15 EDT 2009
Got it working. Thanks for your help
1) login to B
2) setup a tunnel in the shell machine-B> ssh -L
B_ip_address:B_port:C_ip_address:C_port user at C_ip_address
machine-B has ip 184.108.40.206
machine-C has ip 220.127.116.11
then I would type:
machine-B> ssh -L 18.104.22.168:3307:22.214.171.124:3306 user at 126.96.36.199
now the code that is running on machine-A would use MySQLdb in the
connection = MySQLdb.connect
NOTE: the port is an integer, NOT a string
On Jul 12, 9:18 pm, Riley Crane <vodkal... at gmail.com> wrote:
> 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.
> 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)
> 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?
More information about the Python-list