MySQL connection is slow.

Source: Internet
Author: User
Tags reverse dns

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

Related Article

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.