Bug #60465 MySQL-5.5 readline (editline) -- CTRL-R does not work
Submitted: 14 Mar 2011 19:59 Modified: 13 May 2011 11:54
Reporter: Matt Sturtz Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.5.9-1 OS:Linux
Assigned to: CPU Architecture:Any
Tags: ^r, cli, ctrl-r, editline, readline

[14 Mar 2011 19:59] Matt Sturtz
Description:
In previous command line clients that were built with readline, pressing ^r would provide a searchable history.  In 5.5 with Editline, this is broken, even though editline itself is supposed to support this.

How to repeat:
[msturtz@canyon db]$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 276196
Server version: 5.0.36sp1-enterprise-gpl MySQL Enterprise Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> [PRESS ^r HERE, AND THEN START TYPING "show"]
(reverse-i-search)`show': show databases;

[root@proc27.pop.imageinclude.com ~]$ mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.9-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> [PRESSING ^r HERE DOES NOTHING]

Suggested fix:
Remove editline in favor of the far better readline
[15 Mar 2011 4:06] Valeriy Kravchuk
It is impossible to use readline in  5.5.9-enterprise-commercial-advanced or other "commercial" binaries because of the license issues (readline is GPL software).

At best I see a request here to add history search feature to editline implementation...
[15 Mar 2011 4:13] Matt Sturtz
Not sure how the license is a problem, is MySQL itself no longer GPL???  Is there a link where I can read about the change in licensing?

As we are a paying enterprise customer, how do I enable readline in those packages (or is that a question for another channel, and if so, what/where)?

Yes, then, enabling the ^r history search feature of Editline (if such exists, which I gather that it does), would be the logical conclusion of this bug report.
[15 Mar 2011 4:30] Valeriy Kravchuk
Binaries with "commercial" in version string had never been GPL, and had always used Editline.

I consider this a feature request for adding history search to mysql client that uses Editline.

As a workaround you can just use any recent mysql client version that uses Readline. Other options and related matters you should better discuss in a SR at support.oracle.com (if you are a customer).
[13 May 2011 11:54] Davi Arnaut
Editline does support reverse history search, just not with the same key combination. The key binding can be set via the ~/.editrc file by adding the following line: "bind "^R" em-inc-search-prev". See man editrc for more details. Incidentally, there was a bug with reading from ~/.editrc, see Bug#49967.
[4 Oct 2011 10:21] Simon Mudd
Matt, we're in a similar situation to yourself. I'm trying to take this up with support as it's not clear at least from this bug report if any action is planned to help those of us who are in a similar situation and would like readline compatibility, even if that is not from linking against GNU readline.

Davi, does editline support full GNU readline compatibility or does it only support some of readline's functionality? If the latter then the change from one library to the other is not idea for those of us who have become accustomed to the previous client versions.