How to clear query cache in mysql?

后端 未结 3 481
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 19:18

I tried this at root prompt but didnt help.

mysql> RESET QUERY CACHE;

IT showed

Query OK, 0 rows affected (0.00 sec)
         


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-02-01 19:52

    Query cache and query history are different things.

    Query Cache

    MySql stores executed queries with their results in a query cache, so it can quickly respond when the same query requested (cache hit). Run RESET QUERY CACHE or FLUSH TABLES to clear query cache.

    Command History File

    MySql stores commands executed from its own shell in a history file. It is located under your home directory (Unix): ~/.mysql_history. Remove this file to clear history up to now (from shell):

    rm -rf ~/.mysql_history
    

    If you want to disable history completely, create the history file as a symlink to /dev/null (from shell):

    ln -s /dev/null $HOME/.mysql_history
    

提交回复
热议问题