
Le client MySQL en ligne de commandes est décidément puissant ...
Vous avez peut-être déjà été confrontés à la difficulté de lecture de résultats contenant de nombreuses colonnes ...
Exemple :
mysql> SHOW SLAVE STATUS;
+----------------------------------+---------------+-------------+-------------+---------------+------
------------+---------------------+------------------+---------------+-----------------------+---------
---------+-------------------+-----------------+---------------------------------------------+----------
----------+------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
-----------------------------------+-------------------------+-----------------------------+------------+
------------+--------------+---------------------+-----------------+-----------------+----------------+
---------------+--------------------+--------------------+--------------------+-----------------+-------
------------ +----------------+-----------------------+
| Slave_IO_State | Master_Host | Master_User | Master_Port | Connect_Retry | Master_Log_File | Read_Master_Log_Pos | Relay_Log_File | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File | Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seconds_Behind_Master |
+----------------------------------+---------------+-------------+-------------+---------------+------
------------+---------------------+------------------+---------------+-----------------------+---------
---------+-------------------+-----------------+---------------------------------------------+----------
----------+------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
-----------------------------------+-------------------------+-----------------------------+------------+
------------+--------------+---------------------+-----------------+-----------------+----------------+
---------------+--------------------+--------------------+--------------------+-----------------+-------
------------ +----------------+-----------------------+
| Waiting for master to send event | XXX.XXX.XXX.XXX | XXXX | 3306 | 60 | mysql-bin.001632 | 156629364 | relay-bin.000825 | 156629501 | mysql-bin.001632 | Yes | Yes | | | | | | | 0 | | 0 | 156629364 | 156629501 | None | | 0 | No | | | | | | 0 |
...
Dans ce cas, il vous suffit de remplacer le ; en fin de commande par \G pour obtenir une sortie en "fiches" :
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: XXX.XXX.XXX.XXX
Master_User: XXXX
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.001632
Read_Master_Log_Pos: 156842311
Relay_Log_File: relay-bin.000825
Relay_Log_Pos: 156842448
Relay_Master_Log_File: mysql-bin.001632
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 156842311
Relay_Log_Space: 156842448
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)