Sunday, October 4, 2015

Pretty MySQL

Recently MySql became a regular part of my day job.
As with other I struggled with reading wide tables on the console.

Quick tips for developers try the following:

1.  Enabling vertical mode, using "\G" to execute the query instead of ";", i.e. mysql> SELECT * FROM sometable \G

2. Enable less pager with nowrap option
mysql> pager less -SFX
mysql> SELECT * FROM sometable;
This will pipe the outut through the less command line tool which - with these parameters - will give you a tabular output that can be scrolled horizontally and vertically with the cursor keys.


Trust me #2 is a winner.
Try and see for yourself.

No comments: