Mysql – Missing commands in MySQL command line history

command linemac os xMySQL

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

Best Answer

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