linux server empties MySQL's history history Delete mysql operation record

  • 2020-06-12 10:47:34
  • OfStack

1. No longer keep historical records or reduce the amount of historical records

Modify /etc/profile to change HISTSIZE=1000 to 0 or the number to be retained
Clear.bash_history under user home's path


echo '' > /home/user/.bash_history

2. Immediately empty the history record of current history commands


history -c

Of course, if you want the currently executed command to be written to history immediately, you can


history -w

Otherwise, you'll have to wait until you exit bash to write it. For the duration of bash, these are stored in the current buffer.

If you are an MySQL user, you will have a.mysql_history file in the user directory that holds the SQL statements executed on the mysql command line. Empty the use


echo '' > /home/user/.mysql_history


Related articles: