A server uses php to connect to the database, but the database address uses an external ip address, resulting in occasional access to the database connection handle requires 2 seconds. the Last Post is from u011822059 to 2013-09-0311: 29: 58 Editing example: on the server, php connects to the mysql database on the server. on the server where the database is located, php connects to the database, but the database address uses an external ip address, it may take 2 s to occasionally obtain the database connection handle.
This post was last edited by u011822059 at 11:29:58, as shown in the following figure:
On the server, php connects to the mysql database on the server, but the database address uses an external ip address, which may take 2 s to occasionally obtain the mysql database connection handle,
That is to say, the database address connected to mysql uses an Internet ip address (for example, 22.34.1.12 ),
If it is changed to 127.0.0.1, it will not be new. it takes two seconds to obtain the connection handle,
This 2 S occurs occasionally. I want to know the reason. what is the specific point? Thank you, php? Mysql? Connection handle? Internet ip address php 2 s connection handle mysql shared:
------ Solution --------------------
If there is only one ip address, you can directly access
If two or more ip addresses exist
------ Solution --------------------
Server-> firewall-> isp-> firewall-> mysql, and then reverse, it is hard to say how many circles the isp circle around.
------ Solution --------------------
Reference:
2 s is really within the acceptable range. MYSQL has a parameter that sets the domain name not to be resolved to enable this.
Mysql users are actually composed of the host name and user name. Therefore, the host name of the client is determined during mysql login,
In this process, the mysql server needs to reverse resolve the client's IP address to determine the client's host name.
You can modify the skip-name-resolve parameter to set it.