Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Hi I have a MySQL server that I need access through a VPN.

I use MySQLdb package to access MySQL server in Python.

When I can access the server without VPN, it works fine, but when I'm at certain locations, I need to connect through VPN.

My computer is connected to the VPN and I can access the database through PHPMyAdmin, but MySQLdb gives me an error message: OperationalError: (2003, "Can't connect to MySQL server on 'MY_IP' (10061)")

Any ideas on why it's not working? Thanks

share|improve this question

migrated from stackoverflow.com Apr 9 '10 at 4:23

This question came from our site for professional and enthusiast programmers.

    
Sounds like more of a Server Fault issue. Your problem is not with Python. –  jemfinch Apr 8 '10 at 23:19

3 Answers 3

PHPMyAdmin is a web application, which your VPN probably lets by with ease (TCP port 80 or https on 443). Your VPN probably isn't letting the MySQL port though (TCP 3306, if it is the default).

Good luck,

--jed

share|improve this answer

To check Jed's suggestion above (open a cmd window if you are on Windows) replace 192.168.201.1 with the IP or hostname of your mysql server. If it's blocked you will see something like :

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

If it's the former, then show that to the VPN/Firewall admin person and they should be able to help.

Hope this helps.

share|improve this answer

By default, 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, not just 127.0.0.1 and that there is no firewall on the machine preventing connections on port 3306.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.