Clear MySQL query cache without restarting server

后端 未结 3 1948
谎友^
谎友^ 2020-11-28 18:38

Is there any way to clear mysql query cache without restarting mySQL server?

相关标签:
3条回答
  • 2020-11-28 18:51

    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;
    
    0 讨论(0)
  • 2020-11-28 18:58

    according the documentation, this should do it...

    RESET QUERY CACHE 
    
    0 讨论(0)
  • 2020-11-28 19:07

    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.

    0 讨论(0)
提交回复
热议问题