在linux下使用mysql(特指MySQL的客戶(hù)端工具)進(jìn)行查詢(xún),當數據比較多時(shí),很快就一頁(yè)一頁(yè)的翻過(guò)去了,無(wú)法看清數據。
在Linux下是有辦法看清每一頁(yè)的數據的??梢杂?-pager參數
比如mysql --pager=more
或者mysql --pager=less
這樣每顯示滿(mǎn)一頁(yè),就會(huì )等待你按鍵來(lái)翻頁(yè),比如按空格鍵。按q則退出此查詢(xún),不用等到全部顯示完。
如果使用了--pager=less還可以按B鍵來(lái)往前翻頁(yè),看已經(jīng)看過(guò)的數據。使用上下箭頭鍵也可以逐行上下移動(dòng)。
還可以在mysql中使用pager命令,比如
[gulei@ARCH1220 ~]$ mysql EICSNEW
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 15253 to server version: 5.0.17c-pro-gpl-cert
Type ‘help;‘ or ‘h‘ for help. Type ‘c‘ to clear the buffer.
mysql>pager less -S
PAGER set to ‘less -S‘
之后再使用select進(jìn)行查詢(xún),過(guò)寬的行(超過(guò)屏幕寬度)也不會(huì )換行了,可以使用左右箭頭鍵來(lái)橫滾,數據顯示整齊多了。
總之把pager指定為less以后,less的所有功能都可以使用了,包括前后翻頁(yè)、左右橫滾、查找字符串等等。
用man less看一下手冊就行了,功能多了。

