How to clear query cache in mysql?

后端 未结 3 491
隐瞒了意图╮
隐瞒了意图╮ 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 20:01

    If, in fact, we are answering how to clear the "history" (not the cache), and we're talking about a 'nix platform... there is another important history file to delete potentially. I.e. /root/.mysql_history.

    When accessing MariaDB (i.e. a MySQL fork if you were not aware), it's typical to launch it as sudo. In which which case your client input history is written to /root... instead of your home directory.

    If you want to clear all recent input on BOTH the mysql client and the bash terminal for security purposes, try executing the following:

    rm -rf ~/.mysql_history
    sudo rm -rf /root/.mysql_history
    history -cw
    clear
    

    I've used that successfully on CentOS and Debian running MySQL or MariaDB.

提交回复
热议问题