When a new client connects to Mysqld, Mysqld creates a new thread to process the request. The thread first checks whether the host name is in the hostname cache. If not, the thread attempts to resolve the host name:
If the operating system supports thread-safe gethostbyaddr_r () and Gethostbyname_r () calls, threads use them to perform host name resolution.
If the operating system does not support thread-safe calls, the thread locks a mutex and invokes gethostbyaddr () and gethostbyname (). In this case, before the 1th line threads unlocked the mutex, no other thread can resolve the host name that is not in the host name cache.
You can disable DNS host name lookup by starting mysqld with the--skip-name-resolve option. In this case, however, you can only use the IP number in the authorization table in MySQL.
If you have a very slow DNS and many hosts, you can improve performance by disabling DNS lookups with--skip-name-resolve or by adding host_cache_size definitions (default: 128) and recompiling mysqld.
You can use the--skip-host-cache option to start the server to disable host name caching. To clear the host name cache, execute the FLUSH hosts statement or execute the mysqladmin flush-hosts command.
If you want to completely disable TCP/IP connections, start the mysqld with the--skip-networking option.