Paginate Results within MySQL Command Line Tool

Did you know it is possible to use a standard pager, such as less, within the MySQL command line tool?
Using the pager, you can scroll throught the result of your queries more easilly.

Setting the pager
[sql toolbar=false]
mysql> pager less
PAGER set to ‘less’

[sql toolbar=false]
mysql> use mysql
mysql> show tables
| Tables_in_mysql |
| columns_priv |
| db |
| event |
| func |

Reminder: press the ‘q’ key to escape from the pager.

Disabling the pager
[sql toolbar=false]
mysql> nopager
PAGER set to stdout

These features are only available on GNU/Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *