MySQL connection is slow.
Problem: Recently, the IP address is changed because the server has changed the network segment. After the change, the MySQL client is used to connect to the MySQL server and open the table on the client is very slow (regardless of the table size ), even if the connection times out, but directly log on to the server to connect to MySQL locally, the speed is normal.
Cause:After the MySQL database receives a network connection, it first obtains the IP address of the other party, and then performs reverse DNS resolution on the IP address to obtain the host name corresponding to the IP address. Use the host name in the permission system for permission determination. Reverse DNS resolution is time-consuming and may make users feel slow. Sometimes, if the host name resolved in reverse direction does not point to this IP address, the connection will fail.
Solution:
To avoid this lookup process, you can append the following configuration under [mysqld] of MySQL configuration file my. cnf:
[Mysqld]
Skip-name-resolve
The following information is provided for reference:
1. MySQL DNS lookup results in slow connection
2. MySQL DNS reverse resolution causes connection timeout
3. Slow SSH connection and reverse resolution