1

I am using the msyql-client, and I open a mysql prompt on a terminal via:

$ mysql -h localhost -uuser -ppassword
mysql> 

I use the msql client version:

Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

For terminals with emacs-like bindings, I have a very strong muscle memory to use

Ctrl + W

to delete the last word. Yet inside the mysql client, it deletes back to the start of the line and hence it's hard for me to write or adapt queries.

Can I rebind the keyboard shortcuts for mysql client and, if so, how? I know that I can use Alt + Backspace instead, yet I want to keep my usage consistent.

  • Ctrl-w is a readline function, it should work the same in all readline-enabled applications. If it doesn't work in mysql then your mysql might be compiled without it. You can check with mysql --version (it should say something like "... using readline 5.1"). – Satō Katsura Mar 29 '17 at 10:19
  • @SatoKatsura I see mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine wrapper; I guess "EditLine" is not the same as "ReadLine"? – k0pernikus Mar 29 '17 at 10:20
  • Nope. Complain to the maintainer. – Satō Katsura Mar 29 '17 at 10:21
  • @SatoKatsura Is readline a de-facto standard? editline is marketed as a readline alternative without ncurse, so the maintainer might have thought of it as a feature. – k0pernikus Mar 29 '17 at 10:23
  • Well, it isn't readline, thus the difference with Ctrl-w. No idea if / how it can be configured to do what you want. shrug – Satō Katsura Mar 29 '17 at 10:25
2

As a workaround, I installed mariadb, the community-driven fork of mysql, and use its mysql client, since that client comes with readline:

sudo apt install mariadb-client
mysql --version
mysql  Ver 15.1 Distrib 10.0.29-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

You can use just the same as the mysql client.


Keep in mind that it will uninstall mysql, even though I consider this a feature.

It appears the maintainers of mysql dropped readline in favor of editline due to licensing reasons. (Editline seems to be BSD, readline is GNU, and the latter seems to conflict with their desire for providing a commercial version.)

These are the relevant bug reports I found in that regard:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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