Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With mysql command line client on Ubuntu 14.04 I could bind UP to a backward command search by adding the following lines to ~/.inputrc

# type a word, hit up and a search is performed
# "\e[A": history-search-backward

This inputrc setting would be read and provide customised bindings in MySQL command line, i.e. start interactive MySQL command line:

% mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.12-0ubuntu1 (Ubuntu)

Then once in I could type a word and hit UP and the mysql command line would perform a backward search through the command history based on the word:

mysql> select <UP>

would give results like

mysql> select * from user;

I literally had the same settings in 14.04 and they worked, now in ubuntu 16.04 and mysql-client-5.7 this doesn't work, instead I simply get the default behaviour of showing previous commands in chronological order.
How can I get the UP key to perform a command history search in mysql command line?

share|improve this question
    
Does this work in other programs that use readline, such as bash and rlwrap? – Gilles Jun 3 at 21:26
    
@Gilles I believe so. an SQLite prompt seems to read my ~/.inputrc. I discovered that this version of MySQL 5.7.x is compiled using editline library - Im pretty sure thats the problem. – the_velour_fog Jun 3 at 21:33
    
That would do it. Please post this as an answer! – Gilles Jun 3 at 21:40

I discovered that this version of MySQL 5.7.x on ubuntu 16.04 is compiled using editline library not readline - Im pretty sure thats the problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.