User Tools

Site Tools


db:shownicetables

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:

Screenshot

mysql> pager less -SFX;
mysql> SELECT * FROM mysql.user;

In the created view, use cursor keys to navigate horizontally and vertically. Press q to exit.

To unset the pager:

mysql> nopager

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

To set this automatically for mysql console sessions, put in my.cnf in the [mysql] section:

[mysql]
pager=less -SFX

db/shownicetables.txt · Last modified: 2013/03/16 17:40 (external edit)