Pagination in mysql CLI

April 6th, 2011 von sdohn

Pagination in mysql CLI
Ever wonder how to scroll upwards in mysl resultset ?

What if your terminal doesn’t allow scrollback or the scrollback buffer is somehow set to sreen lines ?

How to use MORE or LESS unix commands in mysql which would allow to scroll using ‘return’ or ’spacebar’

Follow the steps given below:

mysql –page uuser -p  [Invoke mysql using the --page command] 
mysql> pager less          [set the pager to use less] 
mysql> select * from table_name  [run your query]

This also works under the unix ’screen’ terminal emulation