Input-line editing is a feature of Mysql, which enables you to modify the current input line in place or recall previous input lines. For example, the left-arrow and right-arrow keys move horizontally within the current input line, and the up-arrow and down-arrow keys move up and down through the set of previously entered lines. Backspace deletes the character before the cursor and typing new characters enters them at the cursor position. To enter the line, press Enter.
On Windows, the editing key sequences are the same as supported for command editing in console windows. On Unix, the key sequences depend on the input library used to build Mysql (for example, the
To change the set of key sequences permitted by a given input library, define key bindings in the library startup file. This is a file in your home directory: .editrc for libedit and .inputrc for readline.
For example, in libedit, Control+W deletes everything before the current cursor position and Control+U deletes the entire line. In readline, Control+W deletes the word before the cursor and Control+U deletes everything before the current cursor position.
From Mysql 5.6 onwards, this feature is not enabled by default. But if we prefers the readline behavior for these two keys can put the following lines in the .editrc file (creating the file if necessary):
bind "^W" ed-delete-prev-word
bind "^U" vi-kill-line-prev
Now all the sql querries will be saved to the history.