在linux下使用mysql(特指mysql的客户端工具)进行查询,当数据比较多时,很快就一页一页的翻过去了,无法看清数据。 在linux下是有办法看
在linux下使用mysql(特指mysql的客户端工具)进行查询,当数据比较多时,,很快就一页一页的翻过去了,无法看清数据。
在linux下是有办法看清每一页的数据的。可以用--pager参数
比如mysql --pager=more
或者mysql --pager=less
这样每显示满一页,就会等待你按键来翻页,比如按空格键。按q则退出此查询,不用等到全部显示完。
如果使用了--pager=less还可以按b键来往前翻页,看已经看过的数据。使用上下箭头键也可以逐行上下移动。
还可以在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进行查询,过宽的行(超过屏幕宽度)也不会换行了,可以使用左右箭头键来横滚,数据显示整齐多了。
总之把pager指定为less以后,less的所有功能都可以使用了,包括前后翻页、左右横滚、查找字符串等等。用man less看一下手册就行了,功能多了。