MySQL the command line and pagers

谁说我不能喝 提交于 2019-12-04 02:38:26

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.

mysql> pager less
PAGER set to 'less'

This post is old, but still very helpful.

You can set the pager to whatever you want, including a script that parses all output before feeding it back to you. The examples there include using an add-on tool that makes EXPLAIN output more readable.

Also note that to turn off this functionality and return to normal stdout the command is nopager.

You might want to try pspg: Unix pager designed for work with tables. Designed for PostgreSQL, but MySQL is supported too.

Main target

  • possibility to freeze first few rows, first few columns

  • possibility to use fancy colors - like mcview or FoxPro

In action:

If you don't like less you can use more :)

\P more
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!