Slow connection to local MySQL in Windows 7/8 and mysql in Windows

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.