Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a remote server running MySQL, with a LAMP server in the same location. The LAMP server can connect to the MySQL server (over the local network) with no problem, most of the time.

I also have a VPN server on the MySQL box (only way I can get a static IP for my home connection). I can connect to the VPN just fine, and browse the web through it, SSH through it, etc.

However, when I connect to my VPN server, PHP can no longer connect to the MySQL server. Once I disconnect, PHP can connect to the MySQL server again.

I'm not even sure where to start fiddling to fix this. Is this a VPN problem? A firewall problem? A problem with Apache? It smells like a VPN problem, as it goes away when I disconnect, but I can't find any indication why this should happen when I connect to the VPN.

share|improve this question

Your VPN connection affects routing so your system cannot access local network anymore. The very simple way for your case IMO - add a static route to your MySQL server.

share|improve this answer
Thanks Sergey. I'm not sure I understand. The static route should be added to the MySQL server, or should be a route to the MySQL server? – Dave Child Mar 12 '14 at 15:15
If the IP addresses are different then routing isn't the problem it's the forwarding on the remote system. An iptables rule to capture the traffic at the vpn server and redirect it to localhost might be more appropriate - however mysql authentication can be tied to IP addresses and may need updated. – symcbean Mar 12 '14 at 17:04

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.