'Slow remote MySQL connection

I have a local WordPress installation setup that uses a remote MySQL DB connection. The MySQL server is my VPS, and my VPS is also the DNS server.

I have MySQL setup with the skip-name-resolve option, as suggested by other posts. The connection still takes a good 5 seconds to load though.

I'm using BIND inside Webmin to manage my DNS. I am no expert by any means...

Any ideas on how to improve performance between my local machine and MySQL remote server?

Note: if it's relevant, when I run a DIG command on the server IP address, it comes back in 5mil seconds. I also have port 3306 opened up in my iptables.



Solution 1:[1]

Doesn't matter if your client machine can resolve the server's in milliseconds. MySQL itself has to do a reverse DNS lookup on your client's IP address as well, to validate the connect in the other direction. E.g. if you created your account as foo@clientmachine, then MySQL has to resolve your client's IP and see if it resolves to clientmachine.

You could probably speed things up by using a dotted quad instead, e.g. [email protected], because that'll be the FIRST thing mysql checks, before it tries to do the PTR lookup.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marc B