Is there any way to clear mysql query cache without restarting mySQL server?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I believe you can use...
RESET QUERY CACHE;
...if the user you're running as has reload rights. Alternatively, you can defragment the query cache via...
FLUSH QUERY CACHE;
See the Query Cache Status and Maintenance section of the MySQL manual for more information.
回答2:
In my system (Ubuntu 12.04) I found RESET QUERY CACHE
and even restarting mysql server not enough. This was due to memory disc caching.
After each query, I clean the disc cache in the terminal:
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
and then reset the query cache in mysql client:
RESET QUERY CACHE;
回答3:
according the documentation, this should do it...
RESET QUERY CACHE