FLUSH
syntax (clearing caches)
FLUSH flush_option [,flush_option]
You should use the FLUSH
command if you want to clear some of the internal caches MySQL uses. To execute FLUSH
, you must have the reload privilege.
flush_option
can be any of the following:
HOSTS | Empties the host cache tables. You should flush the host tables if some of your hosts change IP number or if you get the error message Host ... is blocked . When more than max_connect_errors errors occur in a row for a given host while connection to the MySQL server, MySQL assumes something is wrong and blocks the host from further connection requests. Flushing the host tables allows the host to attempt to connect again. See section 20.3.3 Host '...' is blocked error.) You can start mysqld with -O max_connection_errors=999999999 to avoid this error message. |
LOGS | Closes and reopens the standard and update log files. If you have specified the update log file without an extension, the extension number of the new update log file will be incremented by one relative to the previous file. If you have used an extension in the file name, MySQL will close and reopen the update log file. See section 21.3 The update log. |
PRIVILEGES | Reloads the privileges from the grant tables in the mysql database. |
TABLES | Closes all open tables. |
TABLES WITH READ LOCK | Closes all open tables and locks all tables for read until one executes UNLOCK TABLES . |
STATUS | Resets most status variables to zero. |
You can also access each of the commands shown above with the mysqladmin
utility, using the flush-hosts
, flush-logs
, reload
or flush-tables
commands.