简体   繁体   中英

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.

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. Eg 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, eg foo@1.2.3.4 , because that'll be the FIRST thing mysql checks, before it tries to do the PTR lookup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM