Syntax
------

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

or when flushing tables:

FLUSH [NO_WRITE_TO_BINLOG | LOCAL] TABLES [table_list]  [table_flush_option]

where table_list is a list of tables separated by , (comma).

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.

If a listed table is a view, an error like the following will be produced:

ERROR 1347 (HY000): 'test.v' is not BASE TABLE

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:

+---------------------------+------------------------------------------------+
| Option                    | Description                                    |
+---------------------------+------------------------------------------------+
| CHANGED_PAGE_BITMAPS      | XtraDB only. Internal command used for backup  |
|                           | purposes. See the Information Schema           |
|                           | CHANGED_PAGE_BITMAPS Table.                    |
+---------------------------+------------------------------------------------+
| CLIENT_STATISTICS         | Reset client statistics (see SHOW              |
|                           | CLIENT_STATISTICS).                            |
+---------------------------+------------------------------------------------+
| DES_KEY_FILE              | Reloads the DES key file (Specified with the   |
|                           | --des-key-file startup option).                |
+---------------------------+------------------------------------------------+
| HOSTS                     | Flush the hostname cache (used for converting  |
|                           | ip to host names and for unblocking blocked    |
|                           | hosts. See max_connect_errors and              |
|                           | performance_schema.host_cache                  |
+---------------------------+------------------------------------------------+
| INDEX_STATISTICS          | Reset index statistics (see SHOW               |
|                           | INDEX_STATISTICS).                             |
+---------------------------+------------------------------------------------+
| [ERROR | ENGINE |         | Close and reopen the specified log type, or    |
| GENERAL | SLOW | BINARY   | all log types if none are specified. FLUSH     |
| | RELAY] LOGS             | RELAY LOGS [connection-name] can be used to    |
|                           | flush the relay logs for a specific            |
|                           | connection. Only one connection can be         |
|                           | specified per FLUSH command. See Multi-source  |
|                           | replication. FLUSH ENGINE LOGS will delete     |
|                           | all unneeded Aria redo logs. Since MariaDB     |
|                           | 10.1.30 and MariaDB 10.2.11, FLUSH BINARY      |
|                           | LOGS DELETE_DOMAIN_ID=(list-of-domains) can    |
|                           | be used to discard obsolete GTID domains from  |
|                           | the server's binary log state. In order for    |
|                           | this to be successful, no event group from     |
|                           | the listed GTID domains can be present in      |
|                           | existing binary log files. If some still       |
|                           | exist, then they must be purged prior to       |
|                           | executing this command. If the command         |
|                           | completes successfully, then it also rotates   |
|                           | the binary log.                                |
+---------------------------+------------------------------------------------+
| MASTER                    | Deprecated option, use RESET MASTER instead.   |
+---------------------------+------------------------------------------------+
| PRIVILEGES                | Reload all privileges from the privilege       |
|                           | tables in the mysql database. If the server    |
|                           | is started with --skip-grant-table option,     |
|                           | this will activate the privilege tables again. |
+---------------------------+------------------------------------------------+
| QUERY CACHE               | Defragment the query cache to better utilize   |
|                           | its memory. If you want to reset the query     |
|                           | cache, you can do it with RESET QUERY CACHE.   |
+---------------------------+------------------------------------------------+
| QUERY_RESPONSE_TIME       | See the QUERY_RESPONSE_TIME plugin.            |
+---------------------------+------------------------------------------------+
| SLAVE                     | Deprecated option, use RESET REPLICA or RESET  |