Is Flush Hosts deprecated?

Yes, as per MySQL documentation, using the command FLUSH HOSTS is deprecated.

When FLUSH HOSTS is used, MySQL will clear the host cache, which effectively implies MySQL’s record of which hosts are now or have recently connected is reset, allowing you to connect to those hosts again. However, this command is deprecated from MySQL version 8.0.23.

Although it hasn’t been done so yet, it will be removed in upcoming releases.

The alternative is to truncate the Performance Schema host_cache table:

TRUNCATE TABLE performance_schema.host_cache;

The TRUNCATE TABLE operation requires the DROP privilege for the table rather than the RELOAD privilege. You should be aware that the TRUNCATE TABLE statement is not written to the binary log. To obtain the same behavior from FLUSH HOSTS, specify NO_WRITE_TO_BINLOG or LOCAL as part of the statement.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s