I've got a weird bug with the MySQL prompt which has always annoyed me. Sometimes when I type for example:

mysql > select * from users where

I will press backspace and the prompt will suddenly look broken like this:

mysql > mysql > om users wher

It will basically add a mysql > before and overwrite part of the query. Internally the query is still valid (if I finish it and press enter it will work) but it's the display that's broken.

I'm wondering what could be causing this? Is there any way to prevent it?

  • 1
    Do you have an ~/.inputrc file with something in it that may be influencing the way that the Readline library handles the command line? (I believe that the mysql client uses Readline) – Kusalananda Sep 13 '17 at 15:21
  • Are you using a colorized bash prompt? This can cause readline to do weird things as well. – datUser Sep 13 '17 at 17:39

I had this issue and discovered (thanks to @datUser) that colourisation can cause lots of weird things to happen in terminals. You can remove this for execution of a single command by prefixing it with '\' so try starting mysql using \mysql. That worked for me.

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.