MySQL client display results vertically

If you are selecting a single row with a large number of columns in MySQL (a common use case for me at least), here’s a handy tip: you can display the column data vertically instead of horizontally by ending the query with \G instead of a semi-colon.

For example:

SELECT * FROM wp_users WHERE ID = 1\G
*************************** 1. row ***************************
 ID: 1
 user_login: paul
 user_nicename: paul
 user_registered: 2010-07-04 14:04:31
 user_status: 0
 display_name: Paul
1 row in set (0.00 sec)

You can do the same if more than one row is returned, and each one will be separated by asterisks.


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.