Q. How do I clear the mysql command line history stored in ~/.mysql_history file?
A. mysql is a simple SQL shell. It supports interactive and non-interactive use.
On Unix and Linux, the mysql client writes a record of executed statements to a history file. By default, the history file is named .mysql_history and is created in your home directory. To specify a different file, set the value of the MYSQL_HISTFILE environment variable.
Task: CLEAR MYSQL COMMAND LINE HISTORY
Remove ~/.mysql_history by typing following command:
$ > ~/.mysql_history
If you do not want to maintain a history file, first remove .mysql_history if it exists, and then use either of the following techniques:
Set the MYSQL_HISTFILE variable to /dev/null. To cause this setting to take effect each time you log in, put the setting in one of your shell’s startup files.
Create ~/.mysql_history as a symbolic link to /dev/null. You need run following command only once:
$ rm $HOME/.mysql_history
$ ln -s /dev/null $HOME/.mysql_history