MySQL Forums
Forum List  »  Newbie

Re: mysqladmin flush hosts
Posted by: Zach Ellis
Date: October 27, 2023 10:53AM

Hello Japeth

I'm new to mysql so if someone more experienced comes go with them.

from 5.1.12.3 DNS Lookups and the Host Cache section of the manual

Flushing the Host Cache
Flushing the host cache might be advisable or desirable under these conditions:

• Some of your client hosts change IP address.
• The error message Host 'host_name' is blocked occurs for connections from legitimate hosts. (See Dealing with Blocked Hosts.)
Flushing the host cache has these effects:
• It clears the in-memory host cache.
• It removes all rows from the Performance Schema host_cache table that exposes the cache contents.
• It unblocks any blocked hosts. This enables further connection attempts from those hosts. To flush the host cache, use any of these methods:
• Change the value of the host_cache_size system variable. This requires the SYSTEM_VARIABLES_ADMIN privilege (or the deprecated SUPER privilege).
• Execute a TRUNCATE TABLE statement that truncates the Performance Schema host_cache table. This requires the DROP privilege for the table.
• Execute a FLUSH HOSTS statement. This requires the RELOAD privilege.
• Execute a mysqladmin flush-hosts command. This requires the DROP privilege for the Performance Schema host_cache table or the RELOAD privilege.

note from the manual
FLUSH HOSTS is deprecated as of MySQL 8.0.23; expect it to be removed
in a future MySQL release. Instead, truncate the Performance Schema
host_cache table:

From what i read the host cache is used to avoid DNS lookup for each client connection every time they connect to the server instead it saves the info from the first DNS lookup so it dosent have to do it again. So when you clear the host cache all the hosts currently connected will lose there host cache data. When they disconnect and reconnect back their connection info for the DNS will have to be saved again in the cache. So clearing the cache should not disconnect current hosts.

Make sure you read the chapter 5.1.12.3 DNS Lookups and the Host Cache section of the manual to double check before doing it.

Hope this helps
Zach Ellis

Options: ReplyQuote


Subject
Written By
Posted
October 26, 2023 11:25PM
Re: mysqladmin flush hosts
October 27, 2023 10:53AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.