Syntax

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

Description

The FLUSH statement clears or reloads various internal caches used by MariaDB. To execute FLUSH, you must have the RELOAD privilege. See GRANT.

The RESET statement is similar to FLUSH. See RESET.

You cannot issue a FLUSH statement from within a stored function or a trigger. Doing so within a stored procedure is permitted, as long as it is not called by a stored function or trigger. See Stored Routine Limitations, Stored Function Limitations and Trigger Limitations.

By default, FLUSH statements are written to the binary log and will be replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the statement is not written to the binary log.

The different flush options are:

OptionDescription
CLIENT_STATISTICSReset client statistics (see 'show client_statistics').
DES_KEY_FILEReloads the DES key file (Specified with the --des-key-file startup option).
HOSTSFlush the hostname cache (used for converting ip to host names and for unblocking blocked hosts. See max_connect_errors)
INDEX_STATISTICSReset index statistics (see 'show index_statistics').
LOGSClose and reopen all logs. Causes binary logs to rotate.
MASTERDeprecated option, use RESET MASTER instead.
PRIVILEGESReload all privileges from the privilege tables in the 'mysql' database.
QUERY CACHEDefragment the query cache to better utilize its memory. If you want to reset the query cache, you can do it with RESET QUERY CACHE.
SLAVEDepricated option, use RESET SLAVE instead.
SLOW QUERY LOGSClose and reopen the slow query log (but not other logs)
STATUSResets all status variables that can be reset to 0
TABLEClose all open tables.
TABLES ... FOR EXPORTFor InnoDB tables, flushes table changes to disk to permit binary table copies while the server is running. Introduced in MariaDB 10.0.8. See FLUSH TABLES ... FOR EXPORT for more.
TABLES WITH READ LOCKCloses all open tables. New tables are only allowed to be opened with read locks until an UNLOCK TABLES is given.
TABLES WITH READ LOCK AND DISABLE CHECKPOINTAs TABLES WITH READ LOCK but also disable all checkpoint writes by transactional table engines. This is useful when doing a disk snapshot of all tables.
TABLE_STATISTICSReset table statistics (see 'show table_statistics').
USER_RESOURCESResets all per hour user resources. This enables clients that have exhausted their resources to connect again.
USER_STATISTICSReset user statistics (see 'show user_statistics').

You can also use the mysqladmin client to flush things. Use mysqladmin --help to examine what flush commands it supports.

Comments

Comments loading...