Skip to content

Expanded output in MySQL prompt

When you have tables with a large amounts of columns, it can be easy to show the columns vertically, as opposed to horizontally. In Postgresql, you can toggle this with \x. In MySQL it’s a little bit different.

In MySQL you can end your query with a \G instead of a ; and it outputs like this:

select * from permission \G
*************************** 1. row ***************************
 pid: 1
 rid: 1
perm: access content
 tid: 0
*************************** 2. row ***************************
 pid: 2
 rid: 2
perm: access comments, access content, post comments, post comments without approval
 tid: 0

Simple, but I thought I’d blog about it.


1 Comment ( Add comment / trackback )

  1. (permalink)
    Comment by Rowan Rodrik
    On September 5, 2009 at 11:01

    Note that Halfgaar says: with \G instead of a ; and not before the colon.

    I didn’t notice this as first and kept on getting:

    ERROR: no query specified