Clear Command History in MySQL

This seems like it should be obvious and/or easy to find, but I can’t find it anywhere.  When running the "mysql" command-line program under Windows, how do you clear the history of previously-typed commands?

Posted by Anthony on 4 replies


01. Dec 26, 2006 at 05:49pm by Kev:

This is a good question. From my search efforts and testing, it seems that a .mysql_history file  only exists on unix/linux based OSs. It seems like on Windows the history file only exists while logged into the mysql monitor on the command line. If you log back into it, the previous commands are gone.
I don’t know if this helps you at all, but that’s what it looks like to me.

02. Dec 26, 2006 at 05:51pm by Anthony:

I had thought (hoped) that might be the case, but when I logged out and back in, all my previous commands were still there.

Did you actually find a history file on Windows?  I looked in the App Data directories in the Docs & Settings folder and couldn’t find one.

03. Dec 27, 2006 at 02:44pm by Kev:

My commands were not there after entering the mysql monitor...

I searched the entire drive for *mysql* and *hist* but I did not find any relevant files. On my linux machine, I had .mysql_history in my home directory.

04. Mar 31, 2008 at 02:10pm by Gerald Senarclens de Grancy:

Sorry for reopening such an old thread, but I came across it when googling for the issue... so maybe this answer will be of some use to people having the same issue:
as of what I found out, there is no history file in Windows, but the commands seem to be cached as long as the console window is left open, so once you open a new terminal they should be gone.
hth, Gerald

PS: I love how easy and straightforward GNU/Linux is ;)

Reply to this message here:

Your name
Website (optional)

HomeBackCreate PostArchivesLoginCMS by Encodable