I tried this at root prompt but didnt help.
mysql> RESET QUERY CACHE;
IT showed
Query OK, 0 rows affected (0.00 sec)
But history is still there.
How do I clear or delete history for queries that i typed.
With the FLUSH QUERY CACHE command you can defragment the query cache to better utilise its memory. This command will not remove any queries from the cache. FLUSH TABLES also flushes the query cache. The RESET QUERY CACHE command removes all query results from the query cache.
The RESET QUERY CACHE statement removes all query results from the query cache. The FLUSH TABLES statement also does this.
The MySQL query cache is a query results cache. It compares incoming queries that start with SEL to a hash table, and if there is a match returns the results from the previous execution of the query. There are some restrictions: The query must match byte-for-byte (the query cache avoids parsing)
To make sure MySQL Query Cache is enabled use: mysql> SHOW VARIABLES LIKE 'have_query_cache'; To monitor query cache stats use: mysql> SHOW STATUS LIKE 'Qcache%';
Query cache and query history are different things.
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.
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
Mysql runs its own shell. You can delete this history by deleting the file that the history is read from, which is stored in ~/.mysql_history
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With