The \G modifier in the MySQL command line client

A little publicized, but exceedingly useful feature of the MySQL command line client is the \G modifier. It formats the query output nicely, so you can read through it easier. To use it, you just replace the semi-colon at the end of the query with ‘\G’.

For example, checking the master status:

Now try this for the much larger SHOW SLAVE STATUS. Or for the enormous SHOW ENGINE INNODB STATUS.

As you can see, this is a handy option to make your console output much easier to read.

3 Replies to “The \G modifier in the MySQL command line client”

  1. You can use

    mysql -E
    mysql –vertical

    The holy grail is

    mysql –auto-vertical-output

    Which does what it says: if the output is wider than your terminal, it displays in vertical format.

Comments are closed.