alexkras.com

  • Archive
  • Top Posts
  • GitHub
  • LinkedIn
  • Contact

MySQL Pretty Print in Command Line

April 23, 2014 by admin

TLDR; Use \G at the end of your query, as in mysql> SELECT * FROM sometable\G;

I was looking for a better way to output mysql tables in console, and came across the following gem:

mysql> pager less -SFX
mysql> SELECT * FROM sometable;

So an ugly output like this:

Was transformed into a nice looking output like this:

Another option is to add \G at the end of your command. This will change the output just for that command, without changing the default output.

mysql> SELECT * FROM sometable\G;

Filed Under: Tools

Copyright © 2025 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in