A fusion of technology, music, and geekyness.

Achieving Readable Tabular Output in MySQL

I just changed employers a few weeks ago and went from a psql shop to a mysql shop. One of the things that I missed was the ability to set a pager in a .psqlrc file and get readable output from query results. After some digging and ignoring the posts about \G and vertical output which is nearly useless to me I finally found out the proper flags for less to achieve what I wanted.

On the fly:

mysql> \P less -S
PAGER set to 'less -S'

Permanent config:

$ vim ~/.my.cnf

Add the following…

[client]
pager = less -S

Interested in the difference?
Before:

After:

One Response to “Achieving Readable Tabular Output in MySQL”

  1. Rick Guyer says:

    Thanks for the tip. I always hated deciphering long output and didn’t realize there was a way to format/page it like this.

Leave a Reply

Powered by Wordpress | Designed by Elegant Themes