Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top