Making command-line results more readable
From Cosmin's Wiki
Home > MySQL > Making command-line results more readable
Making results more readable
This section refers only to users which are not accessing a MySql database via a graphical environment (like phpmyadmin or others...). Normally each command you pass to MySQL ends with a semicolon (;). However, when passing a command like
SELECT * FROM MYTABLE;
where MYTABLE has a lot of columns, the result will be displayed in a hardly readable form. For this, you could replace the previous statement with
SELECT * FROM MYTABLE \G
This will display results one below the other like this:
*************************** 6. row *************************** Host: % Db: fhn_cos User: fhn Select_priv: Y Insert_priv: Y Update_priv: Y Delete_priv: Y Create_priv: Y Drop_priv: Y Grant_priv: N References_priv: Y Index_priv: Y Alter_priv: Y Create_tmp_table_priv: Y Lock_tables_priv: Y Create_view_priv: Y Show_view_priv: Y Create_routine_priv: Y Alter_routine_priv: Y Execute_priv: Y 6 rows in set (0.00 sec)
I would strongly recommend that you use the (\G) syntax only when you have a small number of rows returned and you want to do a deeper analysis on each column returned. Otherwise, limit the number of columns in your select statement.