> tech

Thursday, 21 December 2006

mysql client shortcuts

I hate it when I start typing a long query in the mysql client (mysql command-line interface) and then I realize that I'm not ready to run it yet or that I need to run a different query first. I either have to hit backspace 137 times, or I sometimes hit ctrl-c thinking I am using a bash shell; which of course kills mysqlclient, requiring me to reconnect.

Fortunately, I've finally found some shortcut key sequences to solve this problem, as well as some other useful tips. (these shortcuts also work in bash)

ctrl-w - 'cut' the word before cursor
ctrl-u 'cut' all input before cursor
ctrl-y 'paste' cut text

alt-f - move forward one word
alt-b - move backwards one word
ctrl-a - move cursor to the begining of the line
ctrl-b - move backwards one character
ctrl-e - move cursor to the end of the line
ctrl-f - move forward one character
ctrl-h - deletes one letter at a time (backspace)
ctrl-l - clear screen
ctrl-r - search previous queries

Trackbacks

    No Trackbacks

Comments

Display comments as (Linear | Threaded)

    No comments


Add Comment


Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA 1CAPTCHA 2CAPTCHA 3CAPTCHA 4CAPTCHA 5