FLUSH TABLES – MySQL

The FLUSH statement can be used to clean or reload various internal caches, flush tables, or acquire locks. Flush means reset.

The command FLUSH TABLES closes all currently open or in use tables. And flushes the prepared statement cache, which makes better use of the available RAM. If no table name is specified, it targets not only the entire database but all databases [with open files on the MySQL].

MySQL> FLUSH TABLES;
Closes all open tables, forces all tables in use to be closed, and flushes the prepared statement cache.

MySQL> FLUSH TABLES WITH READ LOCK;
Closes all open tables and locks all tables for all databases with a global read lock.

MySQL> FLUSH TABLES tbl_name [, tbl_name] … WITH READ LOCK
Flushes and acquires read locks for the named tables.

MySQL> FLUSH TABLES tbl_name [, tbl_name] … WITH READ LOCK
Flushes and acquires read locks for the named tables.

MySQL> FLUSH TABLES tbl_name [, tbl_name] … FOR EXPORT
This FLUSH TABLES variant applies to InnoDB tables. It ensures that changes to the named tables have been flushed to disk so that binary table copies can be made while the server is running.

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s