10/01/2014

MySQL, format output to no-wrap


The MySQL client defaults to  stdout. If the pager ENV is set to a command with arguments it will forward the results to that command and return after it exits. The following example will truncate the columns of output to match the size of the terminal screen, the PuTTY window was resized after each query to demonstrate the effect:

mysql> pager cut -c -$COLUMNS
PAGER set to 'cut -c -$COLUMNS'





This can also be placed in ~/.my.cnf

[mysql]
pager=
cut -c -$COLUMNS