show slave status\G;

黄平俊 发布于 2009/04/28 15:23
阅读 2K+
收藏 0

做主从数据库时,Navicat 8中的控制台(Console)进行查看slave是运行状态,命令是:show slave status\G;

Navicat总是报语法错误!而在mysql的命令行控制台却能正常执行!~~~看来Navicat还有待进一步加强!

\G或\g是用来干嘛的?以下的代码就可以告诉你了!

1、show slave status; 同:show slave status\g; 

+----------------------+-------------+-------------+-------------+--------------
-+------------------+---------------------+----------------------------------+--
-------------+-----------------------+------------------+-------------------+---
--------------+---------------------+--------------------+----------------------
--+-------------------------+-----------------------------+------------+--------
----+--------------+---------------------+-----------------+-----------------+--
--------------+---------------+--------------------+--------------------+-------
-------------+-----------------+-------------------+----------------+-----------
------------+
| Slave_IO_State       | Master_Host | Master_User | Master_Port | Connect_Retry
 | Master_Log_File  | Read_Master_Log_Pos | Relay_Log_File                   | R
elay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Re
plicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Tabl
e | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Er
ror | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | U
ntil_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_Be
hind_Master |
+----------------------+-------------+-------------+-------------+--------------
-+------------------+---------------------+----------------------------------+--
-------------+-----------------------+------------------+-------------------+---
--------------+---------------------+--------------------+----------------------
--+-------------------------+-----------------------------+------------+--------
----+--------------+---------------------+-----------------+-----------------+--
--------------+---------------+--------------------+--------------------+-------
-------------+-----------------+-------------------+----------------+-----------
------------+
| Connecting to master | localhost   | slaver      |        3308 |            60
 | mysql-bin.000301 |                 461 | ccf-3acf6017ef4-relay-bin.000001 |
          98 | mysql-bin.000301      | No               | Yes               | te
st1           |                     |                    |
  |                         |                             |          0 |
    |            0 |                 461 |              98 | None            |
              |             0 | No                 |                    |
             |                 |                   |                |
            |
+----------------------+-------------+-------------+-------------+--------------
-+------------------+---------------------+----------------------------------+--
-------------+-----------------------+------------------+-------------------+---
--------------+---------------------+--------------------+----------------------
--+-------------------------+-----------------------------+------------+--------
----+--------------+---------------------+-----------------+-----------------+--
--------------+---------------+--------------------+--------------------+-------
-------------+-----------------+-------------------+----------------+-----------
------------+
2、show slave status\G;

mysql> show slave status\G;
*************************** 1. row ***************************
             Slave_IO_State: Connecting to master
                Master_Host: localhost
                Master_User: slaver
                Master_Port: 3308
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000301
        Read_Master_Log_Pos: 461
             Relay_Log_File: ccf-3acf6017ef4-relay-bin.000001
              Relay_Log_Pos: 98
      Relay_Master_Log_File: mysql-bin.000301
           Slave_IO_Running: No
          Slave_SQL_Running: Yes
            Replicate_Do_DB: test1
        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: 461
            Relay_Log_Space: 98
            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: NULL
1 row in set (0.00 sec)

ERROR:
No query specified

这就是区别了!!排版的更友好一些吧!!

以此类推,凡是用到 status 的,加上一个\G 可以使信息更容易看一些!

加载中
0
黄平俊
黄平俊

show slave status\G; 不要用分号!

正确 的应该是:show slave status\G

返回顶部
顶部