通过代理的MySQLdb [英] MySQLdb through proxy

查看:107
本文介绍了通过代理的MySQLdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用上述Python库连接到MySQL服务器.到目前为止,我已经在本地工作,并且一切都很好,直到我意识到必须在所有访问都通过代理的网络中使用我的程序.

现在有人可以设置该lib管理的连接以使用代理吗? 或者:您是否知道另一个可以处理此问题的MySQL MySQL Python库?

我也不知道代理服务器是否允许访问标准MySQL端口,或者我如何欺骗它以允许它.也欢迎对此提供帮助.

解决方案

我使用 SSH隧道可解决此类问题. 例如,我正在开发一个连接到oracle数据库的应用程序.

在我的代码中,我编写了连接到本地主机的命令,然后从shell中执行了操作:

ssh -L1521:localhost:1521 user@server.com

如果您在Windows中,则可以使用 PuTTY

I'm using the above mentioned Python lib to connect to a MySQL server. So far I've worked locally and all worked fine, until i realized I'll have to use my program in a network where all access goes through a proxy.

Does anyone now how I can set the connections managed by that lib to use a proxy? Alternatively: do you know of another Python lib for MySQL that can handle this?

I also have no idea if the if the proxy server will allow access to the standard MySQL port or how I can trick it to allow it. Help on this is also welcomed.

解决方案

I use ssh tunneling for that kind of issues. For example I am developing an application that connects to an oracle db.

In my code I write to connect to localhost and then from a shell I do:

ssh -L1521:localhost:1521 user@server.com

If you are in windows you can use PuTTY

这篇关于通过代理的MySQLdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆