Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have a few options I can think of to make your life easier in this regard: </p> <ul> <li><p><strong>readline commands combined with mysql options</strong>: readline accepts commands similar to <a href="http://lpn.rnbhq.org/tools/xemacs/emacs_ref.html" rel="noreferrer">basic emacs commands</a> (can be set to vi as well), or example CTRL-a returns you to the start of a line.</p> <p>this combined with <code>set horizontal-scroll-mode On</code>, a <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?readline%203" rel="noreferrer">readline</a> that you set in <code>~/.inputrc</code>, which allows you to get your input in 1 straight line, putting your cursor at the very end. Combine it with CTRL-a to immediately jump to the beginning and it's quite convenient.</p> <p><code>~/.inputrc</code>:</p> <pre><code>$if Mysql set horizontal-scroll-mode On` # uncomment the commands below to use vi keybindings #set keymap vi #set editing-mode vi $endif </code></pre> <p>(some systems, OSX 10.5 for certain I believe use libedit instead of readline, in which case you need to put it all in <code>~/.editrc</code>, if you're not sure about your system issue the <code>mysql --version</code> command )</p> <p>To look for commands you issued you also have <code>CTRL-r</code>, which allows you to type in a term and your history will be searched for the last occurence.</p> <p>interesting commands are:</p> <ul> <li>CTRL-P go to the Previous command in your history</li> <li>CTRL-N go to the Next command in your history</li> <li>CTRL-R Reverse-search through your history</li> <li>CTRL-S Search forward through your history</li> <li>CTRL-A Move the cursor to the beginning of the line</li> <li>CTRL-E Move the cursor to the end of the line</li> <li>CTRL-W delete a Word backwards</li> <li>ALT-D delete a word forwards</li> <li>CTRL-F move the cursor Forward 1 character</li> <li>CTRL-B move the cursor Backward 1 character</li> <li>ALT-F move the cursor Forward 1 word</li> <li>ALT-B move the cursor Backward 1 word</li> <li>ALT-_ undo<br> <br /><br /></li> </ul> <p>Depending on your shell and the underlying they might not all work or be intercepted though. For example on Konsole, which I use on kde, I had to disable flow-control in advanced settings to allow for CTRL-s amongst others.</p> <p>Finally mysql also gives you the <a href="http://dev.mysql.com/doc/refman//5.5/en/mysql-commands.html" rel="noreferrer">\e command</a> which allows you to edit your commands in your general file editor, if vi or emacs isn't your thing, try nano, it's easy and works well. The main disadvantage of using this is that when scrolling up newlines are ignored bu tabs and spaces aren't. It's a unix only thing but OS X should do fine there, can't check since I don't own any Apple computers, sorry. :)</p> <p>To more easily use this command you could put a readline string macro in <code>~/.inputrc</code> e.g. <code>Control-o: "\\e;\n"</code> would bind CONTROL-o to \e; followed by <em>enter</em> for instant execution. (look at the <a href="http://www.delorie.com/gnu/docs/readline/rlman_32.html" rel="noreferrer">Keybindings Section</a>)<br /><br /></p></li> <li><p><strong>use an alternate shell</strong>: such as <a href="http://ewaters.github.com/altsql-shell/" rel="noreferrer">altSQL</a>: it gives syntax colouring, nice history scrolling and some other niceties, big bonus is that you have the source so you can adapt what you want.<br /><br /></p></li> <li><p><strong>drop the shell and go GUI</strong>: Finally I'd like to plug the nice <a href="http://www.mysql.com/products/workbench/" rel="noreferrer">MySQL workbench</a> to work on your databases, it's cross-platform, free and in my humble opinion a nice tool to work with.</p></li> </ul> <p>I realise it's not a perfect solution and each have advantages and drawbacks but I hope this has helped you along somewhat.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload