User Tools

Site Tools


db:shownicetables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

db:shownicetables [2013/03/16 17:40] (current)
Line 1: Line 1:
 +==== Show nice formatted tables in mysql console ====
 +03.05.2010
 +
 +
 +To view the result that doesn'​t fit in one screen (it's wrapped make it difficult to follow), we'll use the pager program.
 +
 +In the mysql console, drop these commands:
 +
 +{{:​db:​db_screen_nice_mysql_console.png?​nolink&​|Screenshot}}
 +
 +<​code>​
 +mysql> pager less -SFX;
 +mysql> SELECT * FROM mysql.user;
 +</​code>​
 +
 +In the created view, use cursor keys to navigate horizontally and vertically. Press **q** to exit.
 +
 +__To unset__ the pager:
 +
 +<​code>​
 +mysql> nopager
 +</​code>​
 +
 +
 +<​code>​
 +EXPLAINED PARAMETERS
 +-S Causes long lines to be chopped rather than wrapped around
 +-F In case the result fits on the screen (with the need for scrolling), the pager exists (the same as pressing q)
 +-X Skip some initialization
 +</​code>​
 +
 +
 +__To set this automatically__ for mysql console sessions, put in my.cnf in the [mysql] section:
 +
 +<​code>​
 +[mysql]
 +pager=less -SFX
 +</​code>​
  
db/shownicetables.txt ยท Last modified: 2013/03/16 17:40 (external edit)