1

Using mysql directly from the command line (running on Ubuntu 9.10, standard bash terminal), I am unable to use certain keyboard buttons like:

Delete, Control-(arrow right), Control-(arrow left)

Which gets returned to me as:

~;5C;5D

respectively. I'm assuming there must be a flag in mysql that fixes this but I have been unable to find one. Is there a .mysqlconfig file to edit to make this happen on startup?

Hooked
  • 84,485
  • 43
  • 192
  • 261

1 Answers1

1

According to this thread and mysql --version, mysql is compiled with editline instead of readline. From that thread:

I had to add create an .editrc file with the following lines to get ctrl-R and DELETE to work.

bind "\e[3~" ed-delete-next-char 
bind "^R" em-inc-search-prev

Although that didn't work for me.

Another suggestion from that thread did work:

$ sudo apt-get install rlwrap

Then add an alias in ~/.bashrc

alias mysql='rlwrap -a mysql'

This problem may be specific to Ubuntu 9.10

Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
  • The last post on the thread worked for me! (accepted for the find) Reproducing the code used here: $ sudo apt-get install rlwrap $ alias mysql='rlwrap -a mysql So basically it seems you are wrapping another program around mysql to get back the vi-like bindings. From the other comments on the thread it seems like this is a bug with Karmic itself. – Hooked Jan 20 '10 at 18:48
  • This solution seems to handle other terminal-like issues (it worked for Mathematica and MAPLE as well). – Hooked Feb 11 '10 at 18:46