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> SELECT age, name
-> FROM people
-> WHERE age > 20
->
For example, I meant to type age < 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.
Best Answer
Type 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.