I am trying to connect to my server from my local(windows) and access the MySQL DB
With the below code setting up the SSH tunnel through putty, I am not able to access the
MySQL DB.
con = None
con = mdb.connect(user='user',passwd='password',db='database',host='127.0.0.1',port=3308)
cur = con.cursor()
With the below code, I am using paramiko to setup SSH tunnel which is successful but I am not able to connect to MySQL DB
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('host', username='username', password='password')
con = None
con = mdb.connect(user='user',passwd='password',db='database',host='127.0.0.1',port=3308)
cur = con.cursor()
Error:
Error 2003: Can't connect to MySQL server on '127.0.0.1' (10061)
Do I have change the MySQL connecting string settings to access MySQL DB using paramiko If not I need to add anymore parameter for paramiko to simulate SSH tunnel setup like putty.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…