Skip to content Skip to sidebar Skip to footer

Python Code To Establish An Ssh To Remote Server And Then Connect To Mysql

I am trying to write some python code to establish an ssh connection to a remote server and then execute some MYSQL queries (I have left these out of the example for simplicity). A

Solution 1:

The ip address "127.0.0.1" that you use in your connection object refers to localhost, which is the computer the program is running on. You can't remotely connect to the localhost of another computer. You need to replace the host ip address with the ip address of the remote server.

Also you should only need the MySQLdb.connect object, not the ssh object if you connect correctly.

Post a Comment for "Python Code To Establish An Ssh To Remote Server And Then Connect To Mysql"