Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL reverse-i-search

Tags:

mysql

In mysql client (command line), I used to be able to press Ctrl+R to do a reverse incremental search, similarly you can do that in linux console. For some reason this does not work on my new machine.

I'm using mysql client from xampp. The reverse incremental search works on the console but not on mysql. Does anyone know how to 'enable' this?

Thanks

like image 679
Adrian Gunawan Avatar asked Dec 03 '13 23:12

Adrian Gunawan


1 Answers

MySQL 5.6 is built with the editline library, instead of the readline library used in earlier releases of MySQL. So the default key bindings might be a little bit different than you are used to.

Ctrl+R should still be bound to em-inc-search-prev by default. It works fine in my environment.

See also: Bug #60465 MySQL-5.5 readline (editline) -- CTRL-R does not work

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.

And make sure your version of MySQL is not affected by Bug #49967 built-in libedit doesn't read .editrc on linux

If you want to see the current editline key bindings, temporarily add this line to the end of your $HOME/.editrc:

bind

Then start the mysql client. It will output the full set of key bindings currently recognized.

like image 165
Bill Karwin Avatar answered Oct 11 '22 19:10

Bill Karwin