3

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

1
  • Sounds like more of a Server Fault issue. Your problem is not with Python.
    – jemfinch
    Apr 8, 2010 at 23:19

3 Answers 3

1

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

1

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.

0

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.

You must log in to answer this question.