content_image/835095.jpg content_image/835104.jpg content_image/835108.jpg
<img src='content_image/835095.jpg'>

The MySQL server maintains an in-memory host cache that contains client host name and IP address information and is used to avoid Domain Name System (DNS) lookups; see Section 5.1.12.3, “DNS Lookups and the Host Cache” . 

The host_cache_size  variable controls the size of the host cache, as well as the size of the Performance Schema host_cache  table that exposes the cache contents. Setting host_cache_size has these effects: 

•Setting the size to 0 disables the host cache. With the cache disabled, the server performs a DNS lookup every time a client connects. 

•Changing the size at runtime causes an implicit host cache flushing operation that clears the host cache, truncates the host_cache  table, and unblocks any blocked hosts. 

The default value is autosized to 128, plus 1 for a value of max_connections  up to 500, plus 1 for every increment of 20 over 500 in the max_connections  value, capped to a limit of 2000. 

Using the --skip-host-cache  option is similar to setting the host_cache_size  system variable to 0, but host_cache_size  is more flexible because it can also be used to resize, enable, and disable the host cache at runtime, not just at server startup. Starting the server with --skip-host-cache  does not prevent runtime changes to the value of host_cache_size , but such changes have no effect and the cache is not re-enabled even if host_cache_size  is set larger than 0. 

• hostname 

<img src='content_image/835104.jpg'>

The server sets this variable to the server host name at startup. The maximum length is 255 characters as of MySQL 8.0.17, per RFC 1034, and 60 characters before that. 

• identity 

This variable is a synonym for the last_insert_id  variable. It exists for compatibility with other database systems. You can read its value with SELECT @@identity , and set it using SET identity . 

• init_connect 

<img src='content_image/835108.jpg'>

A string to be executed by the server for each client that connects. The string consists of one or more SQL statements, separated by semicolon characters. 

