1

Why aren't all command that are entered in the MySQL command line saved in the command history?

For example, entering the commands

DROP DATABASE mydb;
CREATE DATABASE mydb DEFAULT CHARACTER SET utf8;
GRANT ALL ON mydb.* TO username@host IDENTIFIED BY 'password';

and then trying to go through the history by pressing   ▲   I only see the first two commands.


I'm running MySQL Ver 14.14 Distrib 5.7.17, for osx10.12 (x86_64) installed with Homebrew

1
  • 2
    I suppose is to keep safe admin information, like usernames and passwords. – McNets Feb 16 '17 at 18:15
4

There is an option to prevent some commands that contain specific words from being logged. One common practice is not to log commands that has the word password.

This option is called histignore

More info:

https://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_histignore https://dev.mysql.com/doc/refman/5.7/en/mysql-logging.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.