How MySQL uses DNS

Source: Internet
Author: User
When the mysql client connects to the mysql server (the process is mysqld), mysqld creates a new thread to process the request. This thread first checks whether the host name is in the Host Name

When the mysql client connects to the mysql server (the process is mysqld), mysqld creates a new thread to process the request. This thread first checks whether the host name is in the Host Name

When the mysql client connects to the mysql server (the process is mysqld), mysqld creates a new thread to process the request. This thread first checks whether the host name is in the host name cache. If not, the thread tries to resolve the host name.

If the system is thread-safe, gethostbyaddr_r () and gethostbyname_r () are called to perform host name resolution;

If the system does not support thread-safe calling, the thread locks a mutex and calls gethostbyaddr () and gethostbyname (). In this case, before the 1st threads unlock the mutex, no other threads can resolve the host names that are not in the host name cache.

Use the -- skip-name-resolve option to start mysqld to disable DNS host name search. In this case, you can only use the IP address in the MySQL authorization table, but not the host name.

If DNS resolution is slow and involves many hosts, you can use -- skip-name-resolve to disable DNS lookup or add the HOST_CACHE_SIZE definition (default: 128) and re-compile mysqld to improve performance;

Use the -- skip-host-cache option to enable the server to disable host name caching. To clear the host name cache, run the flush hosts statement or the mysqladmin flush-hosts command.

To completely disable TCP/IP connections, use the -- skip-networking option to start mysqld.

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.