Smokes your problems, coughs fresh air.

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

  1. Rowan Rodrik

    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

© 2024 BigSmoke

Theme by Anders NorenUp ↑