MYPAGER(1)
π NAME π
mypager β bestie, it adds color to your mysql / psql clients' text output π
π¦ SYNOPSYS π¦
Okay so picture this: a pager tool that sprinkles color onto the query results coming out of your MySQL or PostgreSQL command line clients. That's her. That's the whole job. β¨
She will also automatically pull in less when your terminal can't fit the full result in one page β like, if it's too much for one screen, she calls in backup. π«Ά
mypager is meant to be used as a pager from the mysql or psql command line clients.
And to make that happen you must configure them properly. No skipping this part, fr fr. π
USAGE (MYSQL)
Inside the mysql client, use the pager command, then vibe-check it with a simple select:
pager mypager
select 1;
Alternatively, you can set mypager as the default pager in your client configuration. Iconic, honestly.
In $HOME/.my.cnf:
[mysql]
pager = mypager
USAGE (PSQL)
Unlike the mysql client, there is no specific option in the psql client for this β so you'll have to use the PAGER environment variable:
PAGER=mypager psql --connect-options
You may wish to add an alias in your preferred shell rc:
alias psql="PAGER=mypager psql"
Additionally, you'll need to change how query results are shown by editing your $HOME/.psqlrc file:
-- Headers and surrounding pipes for columns
\pset border 2
-- mypager will decide when to switch to less, but will always add color
\pset pager always
-- You may want null to be NULL, at your discretion
\pset null NULL
πΈ CONFIGURATION πΈ
Your config lives at $HOME/.mypager.conf, and you can create a brand new configuration file with the current defaults by using mypager --installconf β so easy, so slay. π
It's also found in the script itself, in the __DATA__ section. iykyk.
CONFIGURATION OPTIONS
Possible styles are documented in Term::ANSIColor, and you can combine them β for example bold cyan is a valid style. Mix and match, main character energy. π
style-intβ Text style for integer (or float) types. Default:greenstyle-nullβ Text style for theNULLvalue. Default:cyanstyle-nudatellβ Text style for datetimes (and date) values. Default:yellowstyle-headerβ Text style for row headers. Default:underlinestyle-rowβ Text style for row header when mysql is used with the\Gflag. Default:magentalong-lines-to-lessβ Defaults to1.- When
1:mypagerwill switch tolessif it encounters any line longer than screen width (even if they fit within the height of the screen). - When
0: it will only take the height as variable to switch toless.
- When
less-optionsβ Options passed on the thelessexecutable, default to-S(chop long lines)less-options-overrides-envβ Defaults to0.
If the $LESS environment variable is already set, the default is to set our config options (less-options) with a lower priority (in case of conflicts). Set to 1 to "override" the environment variable options.
use-lessβ Determine whenmypagerwill use thelessexecutable. Valid options:auto,always,never, default isauto.fix-utf8β Use to "fix" broken MySQL client UTF-8 output.
Heads up bestie β this bug was fixed a while ago, so this option is disabled by default. π
And that's the whole page, babes β this lil' gem is a Perl doc from the User Contributed Perl Documentation collection, and the version/date on the tin is 2021-01-11. Go make your query results pretty. Periodt. ππ¦
π¦ where this page comes from
- debian bookworm: mypager 0.6.3-1 Β· Apache-2.0
- debian trixie: mypager 0.6.3-1 Β· Apache-2.0
- ubuntu jammy: mypager 0.6.3-1 Β· Apache-2.0
- ubuntu noble: mypager 0.6.3-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms