Slow remote MySQL connection

一世执手 提交于 2019-12-13 04:03:11

问题


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.


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



来源:https://stackoverflow.com/questions/20503416/slow-remote-mysql-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!