MySQL host cache

To Nha Notes | April 28, 2021, 5:12 p.m.

Avoid all DNS lookup from the connection by looking for the cache to find the corresponding results of IP and hostname of each client.

  • To view host cache:

    mysql> select ip,host,host_validated,sum_connect_errors,count_authentication_errors from performance_schema.host_cache;
    
  • To invalidate host cache:

    • mysql> flush hosts;
    • mysql> truncate table performance_schema.host_cache;
    • Or wait for the record from the host cache being squeezed.