Bug #71987 Client Console does not keep complete command history
Submitted: 9 Mar 2014 18:05 Modified: 10 Mar 2014 15:40
Reporter: Alex Callard Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:14.14 Distrib 5.6.16 OS:Linux (ubuntu 13.10)
Assigned to: CPU Architecture:Any
Tags: client, command line, history, linux

[9 Mar 2014 18:05] Alex Callard
Description:
Using the command line client, the command history (ie pressing the up cursor key) omits some commands.  I have tried to work out if there is a pattern - but it seems completely random - it's not the last command, it's not failed commands, doesn't seem to be to do with reserved words, doesn't change if running 'forgettable' query with backticks.  Was working with a users table and it remembered all my SELECT * from users, SELECT id FROM users but 'forgot' SHOW TABLES and SELECT password from users. 
Was also reported on Stack Overflow: http://stackoverflow.com/questions/21883909/mysql-client-history-not-logging-some-queries (not by me).

How to repeat:
Sorry, can't offer any help with this.  Some queries getting remembered, some not, have been using the 5.6 client for about 3 weeks and have only just noticed it.
[10 Mar 2014 5:41] MySQL Verification Team
Hello Alex,

Thank you for your report.
Please note that statements are ignored and not logged if they match any pattern in the “ignore” list i.e By default, the pattern list is "*IDENTIFIED*:*PASSWORD*", to ignore statements that refer to passwords.

Please reference - http://dev.mysql.com/doc/refman/5.6/en/mysql-logging.html

E.g

mysql> use test
Database changed
mysql> create table t11(password varchar(100),id int);
Query OK, 0 rows affected (0.05 sec)

^^ now history doesn't allow me to recall above DDL and instead list use test

mysql> use test
Database changed
mysql>
mysql> select user,password from mysql.user;
+------+----------+
| user | password |
+------+----------+
| root |          |
| root |          |
| root |          |
| root |          |
|      |          |
|      |          |
+------+----------+
6 rows in set (0.00 sec)

^^ now history doesn't allow me to recall above DDL and instead list use test

mysql> use test
Database changed
mysql>

Thanks,
Umesh
[10 Mar 2014 13:14] Alex Callard
Thanks for not RTFMing me! :)
[30 Mar 2016 14:21] Phil Stracchino
I understand the rationale behind this feature, and it is well-intended.  However, there are three things wrong with it:
1.  It is poorly implemented and generates false positives.  For instance, any operation that names a schema whose name contains the strings 'password' or 'identified' will always be excluded from the mysql client's command history, even if it is just a "SELECT count(*) from unidentified.foo".
2.  "Ignored" statements are not only excluded from logging, but from in-session history.  This creates many headaches as it means entire commands must be retyped for the sake of a single-character typo.  This rapidly becomes a frustrating annoyance.
3.  Keywords can be added to the ignore list, but not removed, and there is no way to turn this accursed misfeature off if you don't want to use it.

The intent is good.  The implementation is terrible.
[3 Apr 2017 21:04] Dhaval Patel
@phil is right, this is a terrible implementation. Is there anyway this can be made configurable or fix the implementation?
[8 Apr 2017 23:17] Klaus Eicheler
What is the latest MySQL version without this "feature"?