FLUSH [NO_WRITE_TO_BINLOG | LOCAL]
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
FLUSH statement causes an
implicit commit. See Section 13.3.3, “Statements That Cause an Implicit Commit”.
flush_option can be any of the
Reloads the DES keys from the file that was specified with the
--des-key-fileoption at server startup time.
Empties the host cache. You should flush the host cache if some of your hosts change IP address or if the error message
Host 'occurs. (See Section B.5.2.6, “Host 'host_name' is blocked”.) When more than
host_name' is blocked
max_connect_errorserrors occur successively for a given host while connecting to the MySQL server, MySQL assumes that something is wrong and blocks the host from further connection requests. Flushing the host cache enables further connection attempts from the host. The default value of
max_connect_errorsis 10. To avoid this error message, start the server with
max_connect_errorsset to a large value.
Closes and reopens all log files. If binary logging is enabled, the sequence number of the binary log file is incremented by one relative to the previous file.
If you execute
FLUSH LOGSand mysqld is writing the error log to a file (for example, if it was started with the
--log-erroroption), log file renaming occurs as described in Section 5.2.1, “The Error Log”.
Deletes all binary logs, resets the binary log index file and creates a new binary log.
FLUSH MASTERis deprecated in favor of
FLUSH MASTERis still accepted in MySQL 5.0 for backward compatibility, but is removed in MySQL 5.6. See Section 18.104.22.168, “RESET MASTER Syntax”.
Reloads the privileges from the grant tables in the
The server caches information in memory as a result of
CREATE USERstatements. This memory is not released by the corresponding
DROP USERstatements, so for a server that executes many instances of the statements that cause caching, there will be an increase in memory use. This cached memory can be freed with
Resets all replication slave parameters, including relay log files and replication position in the master's binary logs.
FLUSH SLAVEis deprecated in favor of
FLUSH SLAVEis still accepted in MySQL 5.0 for backward compatibility, but is removed in MySQL 5.6. See Section 22.214.171.124, “RESET SLAVE Syntax”.
This option adds the current thread's session status variable values to the global values and resets the session values to zero. Some global variables may be reset to zero as well. It also resets the counters for key caches (default and named) to zero and sets
Max_used_connectionsto the current number of open connections. This is something you should use only when debugging a query. See Section 1.7, “How to Report Bugs or Problems”.
FLUSH TABLESflushes tables, and, depending on the variant used, acquires locks. The permitted syntax is discussed later in this section.
Resets all per-hour user resources to zero. This enables clients that have reached their hourly connection, query, or update limits to resume activity immediately.
FLUSH USER_RESOURCESdoes not apply to the limit on maximum simultaneous connections. See Section 6.3.4, “Setting Account Resource Limits”.
The mysqladmin utility provides a
command-line interface to some flush operations, using commands
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 C.1, “Restrictions on Stored Programs”.
Closes all open tables, forces all tables in use to be closed, and flushes the query cache.
FLUSH TABLESalso removes all query results from the query cache, like the
RESET QUERY CACHEstatement.
With a list of one or more comma-separated table names, this statement is like
FLUSH TABLESwith no names except that the server flushes only the named tables. No error occurs if a named table does not exist.
FLUSH TABLES WITH READ LOCK
Closes all open tables and locks all tables for all databases with a global read lock. This is a very convenient way to get backups if you have a file system such as Veritas or ZFS that can take snapshots in time. Use
UNLOCK TABLESto release the lock.
FLUSH TABLES WITH READ LOCKacquires a global read lock and not table locks, so it is not subject to the same behavior as
UNLOCK TABLESwith respect to table locking and implicit commits:
UNLOCK TABLESimplicitly commits any active transaction only if any tables currently have been locked with
LOCK TABLES. The commit does not occur for
FLUSH TABLES WITH READ LOCKbecause the latter statement does not acquire table locks.
Beginning a transaction causes table locks acquired with
LOCK TABLESto be released, as though you had executed
UNLOCK TABLES. Beginning a transaction does not release a global read lock acquired with
FLUSH TABLES WITH READ LOCK.