Using MySQL in vi mode is very useful as you can easily search for, modify, and run previous commands quickly. Enabling it is very simple.
It’s just a matter of creating a .inputrc file in your home directory and adding the following:
set editing-mode vi
or alternately you could use this:
$if mysql
set editing-mode vi
$endif