Slow connection to local MySQL in Windows 7/8 and mysql in Windows
I found a problem when using the thinkphp framework, that is, there will be a latency of more than one second every time the page is loaded. After searching for it on the internet for a long time, I will know why it is the database connection configuration ~!
Previously, the local database connected by localhost was used. After it was changed to 127.0.0.1, the page loading speed immediately increased by more than 10 times.
In windows, localhost points to the local ipv6 address: 1.
Because mysql is connected to an ipv4 address, the connection may be delayed by 1 s.
The solution is to bind the configuration of the host file in the windows File 127.0.0.1 to localhost.
# Localhost name resolution is handled within DNS itself.
#127.0.0.1 localhost
#: 1 localhost
In this way, the page loading speed will be significantly improved.