Bug #71972 mysql history length limited to 4K
Submitted: 7 Mar 2014 13:03 Modified: 17 Aug 2014 12:30
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.16 OS:Any
Assigned to: CPU Architecture:Any
Tags: client, history, limitations

[7 Mar 2014 13:03] Daniël van Eeden
Description:
The mysql monitor stores command history in ~/.mysql_history but only reads about 4K per command.

This is with 5.6.16 enterprise on RHEL6, but it's probably not limited to this combination.

How to repeat:
Create a query for which the query itself is more than 4K. execute it. then try to recall it from the history. and see that it's truncated. The complete query should still be in the history file.

Suggested fix:
Increase the size of the history entries.
[7 Mar 2014 13:11] Daniël van Eeden
Some python to find the approximate size of the largest entry in the history:
>>> a = open('.mysql_history', 'r').read().split('\n')
>>> maxlen = 0
>>> for i in a:
...     if len(i) > maxlen:
...         maxlen=len(i)
...
>>> print(maxlen)
20245
[10 Mar 2014 5:08] Umesh Shastry
Hello Daniel,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[17 Aug 2014 12:30] Daniël van Eeden
added tags