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.


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)

  • 1
    It's ridiculous that this isn't the default configuration with MySQL/MariaDB. Thanks! – Teekin Aug 14 '17 at 11:10
  • 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 – Igor Tverdovskiy Oct 23 at 12:59

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.