User Tools

Site Tools


Show nice formatted tables in mysql console


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:


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

-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:

pager=less -SFX

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