Connect to database through python proxy script

I have a python script that connects to a remote MySQL database using the python MySQLdb library. It works fine, but how can I connect it through the proxy server I work on. I can connect via command line in ssh, but how do I get a python script to use proxy settings. It seems that there are no parameters in MySQLdb commands for proxy configurations.

   import MySQLdb as mdb

   conn=mdb.connect(host='mysite.com',user='myuser',passwd='mypassword',db='mydb')
   cursor = conn.cursor()
+5
source share
1 answer

I think the port setup in the connect command will work.

conn = mdb.connect(host='slkds.com', port='9000', user='user', passwd='wd', db='my')

or you can install a system proxy for what has ever been executed, and then the script will work

-1
source

All Articles