FLUSH Syntax

FLUSH [NO_WRITE_TO_BINLOG | LOCAL]    flush_option [, flush_option] ...

The FLUSH statement has several variant forms that clear or reload various internal caches, flush tables, or acquire locks. To execute FLUSH, you must have the RELOAD privilege. Specific flush options might require additional privileges, as described later.

By default, the server writes FLUSH statements to the binary log so that they replicate to replication slaves. To suppress logging, specify the optional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.


FLUSH LOGS, FLUSH TABLES WITH READ LOCK (with or without a table list), and FLUSH TABLES tbl_name ... FOR EXPORT are not written to the binary log in any case because they would cause problems if replicated to a slave.

Sending a SIGHUP signal to the server causes several flush operations to occur that are similar to various forms of the FLUSH statement. See Section 5.1.11, "Server Response to Signals".

The FLUSH statement causes an implicit commit. See Section 13.3.3, "Statements That Cause an Implicit Commit".

The RESET statement is similar to FLUSH. See Section, "RESET Syntax", for information about using the RESET statement with replication.

flush_option can be any of the following items.

The mysqladmin utility provides a command-line interface to some flush operations, using commands such as flush-hosts, flush-logs, flush-privileges, flush-status, and flush-tables. See Section 4.5.2, "mysqladmin — Client for Administering a MySQL Server".


It is not possible to issue FLUSH statements within stored functions or triggers. However, you may use FLUSH in stored procedures, so long as these are not called from stored functions or triggers. See Section D.1, "Restrictions on Stored Programs".

In MySQL 5.7.1, gtid_next must be set to AUTOMATIC before issuing this statement. This restriction does not apply in MySQL 5.7.2 or later. (Bug #16062608, Bug #16715809, Bug #69045)


FLUSH TABLES has several forms, described following. If any variant of the TABLES option is used in a FLUSH statement, it must be the only option used. FLUSH TABLE is a synonym for FLUSH TABLES.

Spec-Zone.ru - all specs in one place