DavidJB
DavidJB

Reputation: 2362

SSH using Pythondb using private key

I need to SSH into a db using Python, I'm using PythonDB for this. I saw this question which details how to do this but I can't seem to get the syntax right. Would someone be able to point me in the right direction....? I also need to use a private key, how would I go about inserting that...?

ssh -L 9990:127.0.0.0:3396 <79.xxx.xx.xxx>

database = MySQLdb.connect(host'127.0.0.0', port=3306, user='jack', passwd='pass', db='test')

Upvotes: 0

Views: 1007

Answers (1)

Clemens Klein-Robbenhaar
Clemens Klein-Robbenhaar

Reputation: 3527

As said in the answer to the other question in the ssh-tunnel you are forwarding from port 9990 on your local machine to the (standard mysql) port on the remove machine. To send requests through that ssh-tunnel you need to connect to port 9990 instead of 3306:

database = MySQLdb.connect(host'127.0.0.0', port=9990, ....

Upvotes: 2

Related Questions