MySQL the command line and pagers

martynthewolf picture martynthewolf · Nov 25, 2010 · Viewed 9.1k times · Source

I cant find anything about this from searching here.

I use mysql on the command line at work and I work with fairly large tables so I set the mysql pager allowing a more readable result if I run a query, that returns 1000's of results. I use the command below to set the pager.

\P less -Sin

This suits my needs but has left me wondering if there are any more pager styles that mysql uses on the command line.

Answer

Piskvor left the building picture Piskvor left the building · Nov 25, 2010

The MySQL client just passes its output to whatever command you specify with \P (for "Pager").

-Sin are commandline switches to the program less. From man less:

-i Causes searches to ignore case
-n Suppresses line numbers
-S Causes lines longer than the screen width to be chopped rather than folded.

For more options of the MySQL client, see reference.