I've been using the original MySQL client for "eons" and I'm rather accustomed to using bash-like shortcuts in it. One of my more frequently used ones is to use control-w to delete the word before the cursor (just like you do in bash).

Currently, with my mariadb client -- if I hit control-w it deletes the entire line before the cursor. (which in bash at least is usually control-u)

So for example, try it in a standard bash prompt.... or even in a classic MySQL command prompt, if I have a line like:

SELECT a,b,c FROM table WHERE column='value'

And I have my cursor before WHERE the line will look like

WHERE column='value'

When I really expected it to be:

SELECT a,b,c FROM WHERE column='value'

I'm using Fedora, and the Maria version installed is:

[doug@talos werk]$ sudo rpm -qa | grep -i maria mariadb-10.0.21-1.fc21.x86_64 mariadb-config-10.0.21-1.fc21.x86_64 mariadb-common-10.0.21-1.fc21.x86_64

Other shortcuts work as anticipated, control-a and control-e to go beginning and end of line respectively, and control-[left arrow] moves a word left (or right with right arrow)

I'm running the client with:

mysql -A --host=foo.local -u user -p'mypass'

I can't find a reference to a maria client config options, like a .mariarc or something. I'm happy to take any pointers.

1 Answer 1


I've figured out what's need to be done, and I found the answer in the Mysql Tips article in the mysql manual.

Turns out that the behavior depends on what library MySQL was compiled against, readline or libedit. And you can customize the behavior with a .editrc file.

In my case, to have control+w work as I anticipated it, you would have a .editrc file that looks like:

bind "^W" ed-delete-prev-word

If you'd like to see what the keybindings are, just put the word bind in .editrc (or at the end of an existing .editrc file)

  • 2
    It's ridiculous that this isn't the default configuration with MySQL/MariaDB. Thanks!
    – Teekin
    Commented Aug 14, 2017 at 11:10
  • 1
    Thanks, just to clarify location of the mentioned config /home/<user>/.editrc Also you may place .editrc to the /etc/skel/ directory, so all new users will automatically get these settings Commented Oct 23, 2019 at 12:59
  • Be aware that this doesn't seem to work for mysql/libedit shipped with Ubuntu 20.04: bugs.debian.org/cgi-bin/bugreport.cgi?bug=975911
    – salmin
    Commented Mar 3, 2023 at 16:06
  • I ended up building my own Debian packages for MariaDB that are linked against readline instead. Instructions here: wiki.andybev.com/… Commented Aug 23, 2023 at 7:14
  • I happened to meet "Monty" at a conference. Someone asked, "Hey! What editor do you use?" He replied, blandly, "Emacs", as if it was a weird question, Every one burst out laughing. Commented Nov 30, 2023 at 17:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .