Bug #48287 Stop logging passwords in history
Submitted: 25 Oct 2009 8:08 Modified: 13 Nov 2012 17:52
Reporter: Kevin Benton Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:All OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[25 Oct 2009 8:08] Kevin Benton
Description:
Please change the mysql command-line client so that it stops logging identified by ... and password(...) by default.  This could be overridden in the .my.cnf file using a parameter like this:

[mysql]
avoid_logging_passwords = 0

The goal is to prevent grant passwords from being logged at all in the .mysql_history file.

How to repeat:
See description.

Suggested fix:
See description.
[17 Dec 2009 13:09] Susanne Ebrecht
Many thanks for pointing this out.

In my eyes this is a bug with security risk.
[13 Nov 2012 17:52] Paul DuBois
Noted in 5.6.8, 5.7.0 changelogs.

On Unix systems, the mysql client logs executed statements to a
history file when run in interactive mode (see ). mysql now ignores
for logging purposes statements that match any pattern in the
"ignore" list. By default, the pattern list is
"*IDENTIFIED*:*PASSWORD*", to ignore statements that refer to
passwords. Pattern matching is not case sensitive. Within patterns,
two characters are special:
? matches any single character.
* matches any sequence of zero or more characters

To specify additional patterns, use the --histignore command option
or set the MYSQL_HISTIGNORE environment variable. (If both are
specified, the option value takes precedence.) The value should be a
colon-separated list of one or more patterns, which are appended to
the default pattern list.

Patterns specified on the command line might need to be quoted or
escaped to prevent your command interpreter from treating them
specially. For example, to suppress logging for UPDATE and DELETE
statements in addition to statements that refer to passwords, invoke
mysql like this:

shell> mysql --histignore="*UPDATE*:*:DELETE*"