Clearing the input field in mysql client

Posted on 07 Sep 2011.

Sometimes when I am writing a long command in zsh or bash, I change my mind somewhere in the middle and want to write something completely different. I then hit CTRL-C to start from scratch. Sometimes I find myself trying to do the same thing when writing SQL statements in mysql-client, which results in mysql-client shutting down and my having to log in again. Enlightened by some google searches, I now use the \c sequence to clear the line. An example follows below.

mysql> INSERT INTO my_table (5, 'I think I change my mind'\c

Simply insert \c somewhere in the query and it is ignored.

blog comments powered by Disqus