8.9.8 DNS Lookup Optimization and the Host Cache  The MySQL
server maintains a host cache in memory that contains
information about clients: IP address, host name, and error
information. The server uses this cache for nonlocal TCP
connections. It does not use the cache for TCP connections
established using the loopback interface address (, or for
connections established using a Unix socket file, named pipe, or
shared memory.  For each new client connection, the server uses
the client IP address to check whether the client host name is
in the host cache. If not, the server attempts to resolve the
host name. First, it resolves the IP address to a host name and
resolves that host name back to an IP address. Then it compares
the result to the original IP address to ensure that they are
the same. The server stores information about the result of this
operation in the host cache. If the cache is full, the least
recently used entry is discarded.  The server performs host name
resolution using the thread-safe gethost