当前位置:网站首页>MySQL flush operation

MySQL flush operation

2022-07-06 10:37:00 wx5caecf2ed0645


If you want to clear MySQL Part of the internal cache used , You should use FLUSH sentence . To execute FLUSH, You must have RELOAD jurisdiction .


flush_option

HOSTS

Used to empty the host cache table . If some hosts change IP Or if you get an error message Host host_name is blocked, Then you should refresh the host table . When connected to MySQL Server time , If for a given host , Successive errors “ More than max_connect_errors”, here ,MySQL It is assumed that an error has occurred , And prevent subsequent connection applications from the host . Refreshing the host table allows the host to try to connect again . Please see the A.2.5 section ,“ The host host_name blocked ”. You can use max_connect_errors=999999999 start-up mysqld, To avoid this error message .

DES_KEY_FILE

Used when the server starts , From the adoption of --des-key-file Option to reload the file specified DES keyword .

LOGS

Used to close and reopen all log files . If you have specified an update log file or a binary log file , At the same time, there is no extension , Relative to the previous file , The extension number of the log file increases 1. If you use an extension in the file name , be MySQL Will close and reopen the log file . stay Unix in , When phase mysqld Server sends a SIGHUP Signal time , It will be the same ( The exception is partial Mac OS X 10.3 edition . In these versions ,mysqld Ignore SIGHUP and SIGQUIT).

If the server uses --log-error Options , be FLUSH LOGS This will cause the error log to be renamed ( Use suffix -old), meanwhile mysqld A new empty log file will be created . If there is no given --log-error Options , Will not be renamed .

PRIVILEGES

For from mysql The authorization table in the database reloads permissions .

QUERY CACHE

Defragment the query cache , To make better use of memory . And RESET QUERY CACHE Different , This statement does not cancel any queries from the cache .

STATUS

Used to reset most state variables to zero . Only when debugging queries , You should use this . Please see the 1.7.1.3 section ,“ How to communicate defects and problems ”.

{TABLE | TABLES} [tbl_name [, tbl_name] ...]

When no table is named , Close all open tables , And force all tables in use to close . This will also refresh the query cache . This entry contains one or more table names , Refresh only the given table . and RESET QUERY CACHE The sentence is the same ,FLUSH TABLES It also cancels all query results from the query cache .

TABLES WITH READ LOCK

For all databases with read lock , Close all open tables , And lock all tables , Until you execute UNLOCK TABLES until . If you have a file system that can take snapshots in time , such as Veritas, Then this is a very convenient method for backup .

USER_RESOURCES

Used to reset all hourly user resources to zero . This can make the connection per hour 、 Clients that query or update the limit value immediately resume activity .FLUSH USER_RESOURCES Maximum limit not applicable to simultaneous connections . Please see the 13.5.1.3 section ,“GRANT and REVOKE grammar ”.

FLUSH Statement is written to the binary log , Unless you use your own NO_WRITE_TO_BINLOG keyword ( Or its alias LOCAL). notes : In any case ,FLUSH LOGS, FLUSH MASTER, FLUSH SLAVE and FLUSH TABLES WITH READ LOCK Will not be logged , Because if they are copied to a secondary server , Can cause problems .

You can also use the flush-hosts, flush-logs, flush-privileges, flush-status or flush-tables Command access contains mysqladmin Application statements .




原网站

版权声明
本文为[wx5caecf2ed0645]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131704410362.html