How to Access MySQL Server through VPN Using Python

by alok on April 9, 2010

 

image 

If you are encountered any problem to access the MYSQLdb server through a VPN with error message:

OperationalError: (2003, "Can’t connect to MySQL server on ‘MY_IP’ (10061)")

The simple solution of this problem is:

Open a cmd window if you are using Windows replace 192.168.201.1 with the IP or hostname of your mysql server. If it’s blocked you will see something

 

$ telnet 192.168.201.1 3306Trying 192.168.201.1...

and eventually a timeout.

 

If you can reach the port then you should see something similar to:

 

$ telnet 192.168.201.1 3306Trying 192.168.201.1...Connected to 192.168.201.1.Escape character is '^]'.?5.1.37-1ubuntu5.1C[&Elne0d])O5ZG4mKmdConnection closed by foreign host.


MySQL only allows TCP connections from localhost – assuming your python application is running on the same machine as MySQL, ensure that your MySQL bindings are to the local IP address, and that there is no firewall on the machine preventing connections on port 3306.

  • Share/Bookmark

Leave a Comment

Previous post:

Next post: