Mysql clear cache method: use FLUSH syntax to clear the cache. In order to execute FLUSH, you must have reload permission, the syntax is [FLUSH flush_option [,flush_option]].
Related learning recommendations: mysql tutorial
Mysql clear cache method :
Clear cache
FLUSH syntax for mysql (clear cache)
FLUSH flush_option [,flush_option]
If you want to clear some internal cache used by MySQL, you should use the FLUSH command. In order to execute FLUSH, you must have reload permission.
flush_option
can be any of the following:
HOSTS This is the most used and often encountered. Mainly used to clear the host cache table. If some of your hosts change IP numbers, or if you get the error message Host... isblocked, you should clear the host table. When more than max_connect_errors errors occur continuously for a given host when connecting to the MySQL server, MySQL will block further connection requests from that host for security reasons. Clearing the host table allows the host to try connecting again.
LOGS Close the current binary log file and create a new file. The name of the new binary log file is added to the number of the current binary file by 1.
PRIVILEGES This is also often used. Whenever re-authorization is performed, in order to make the new permissions take effect immediately just in case, it is usually executed. The purpose is to obtain the authorization table from the database. Reload the permissions into the cache.
TABLES Close all open tables, and this operation will clear the contents of the query cache.
FLUSH TABLES WITH READ LOCK Close all open tables and add a read lock to all tables in the database until unlock tables are explicitly executed. This operation is often used for data backup. when.
STATUS Reset most status variables to 0.
FLUSH LOGS,
FLUSH MASTER,
FLUSH SLAVE ,
FLUSH TABLES WITH READ LOCK will not be recorded, so if the above operations are recorded in the binary log file, it will affect the slave database.
If you want to know more about programming learning, please pay attention to thephp training column!
The above is the detailed content of How to clear cache in mysql. For more information, please follow other related articles on the PHP Chinese website!