[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
FLUSH
Syntax
FLUSH [LOCAL | NO_WRITE_TO_BINLOG] 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:
Option | Description |
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
DES_KEY_FILE | Reloads the DES keys from the file that was | specified with the
LOGS | Closes and reopens all log files. | If you have specified an update log file or a binary log file without an extension, the extension number of the 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 5.8.3 The Update Log. This is the same thing as sending the
PRIVILEGES | Reloads the privileges from the grant tables in | the
QUERY CACHE | Defragment the query cache to better utilize its | memory. This command will not remove any queries from the cache, unlike
TABLES | Closes all open tables and force all tables in use to be closed. This also flushes the query cache. |
[TABLE | TABLES] tbl_name [,tbl_name...] | Flushes only the given tables. |
TABLES WITH READ LOCK | Closes all open tables and locks all tables for all databases with a read lock until you execute UNLOCK TABLES . This is very convenient way to get backups if you have a filesystem, like Veritas, that can take snapshots in time. |
STATUS | Resets most status variables to zero. This is something you should use only when debugging a query. See section 1.7.1.3 How to Report Bugs or Problems. |
USER_RESOURCES | Resets all user resources to zero. This will enable blocked users to log in again. See section 5.5.6 Limiting user resources. |
Before MySQL 4.1.1, FLUSH
commands are not written
to the binary log. Since MySQL 4.1.1 they are written to the binary
log unless the optional NO_WRITE_TO_BINLOG
keyword
(or its alias LOCAL
) was used, or
unless the command contained one of these arguments: LOGS
,
MASTER
, SLAVE
, TABLES WITH READ LOCK
, because any
of these arguments may cause problems if replicated to a slave.
You can also access some of the commands shown above with the mysqladmin
utility, using the flush-hosts
, flush-logs
, flush-privileges
,
flush-status
or flush-tables
commands.
Take also a look at the RESET
command used with replication.
See section RESET
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |