How would I undo or edit the last line of a multi-line query in mysql? I often make mistakes when entering multi-line queries in mysql. Is there an easier way to undo the last line instead of retyping the entire query?

mysql&gt; SELECT age, name
    -&gt; FROM people
    -&gt; WHERE age &gt; 20
    -&gt; 


For example, I meant to type age &lt; 20, is there a way to quicky fix that? Normally I would ctrl + C and use the up arrow key to re-enter first two lines quickly, but I feel like there should be an easier way.

I tried reading documentation and read some forums but I couldn't find anything. It should be a new feature if it doesn't exist.
Type edit.

mysql&gt; edit


It would open a vi editor. You can make any number of mistakes and undo them.
Once done with your multiline query, exit(:wq) out the editor.
Type ; to execute your query.

mysql&gt; ;