How MySQL uses DNS bitsCN.com
How MySQL uses DNS
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, no other threads can resolve the host names that are not in the host name cache before the 1st threads unlock the mutex.
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.
BitsCN.com