Mysql connection database localhost is slower than 127.0.0.1

During the development process of php+mysql, when filling in the host name for connecting to the database, the local machine can generally use localhost or 127.0.0.1. In the actual application process, no abnormalities have been found in the Linux system, but in the Windows server system, there are When writing localhost, the web page response will be relatively slow. Generally, it takes more than 1 second to complete a page. I judged the program running time step by step and found that it was a problem when connecting to mysql. It takes nearly 1 second to establish a connection.

Subscribe to network