mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: 10.10.10.2
                  Master_User: hnhl
                  Master_Port: 5595
                Connect_Retry: 0
              Master_Log_File: mysql-bin.000030
          Read_Master_Log_Pos: 106
               Relay_Log_File: mysqld-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File: mysql-bin.000030
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
              Replicate_Do_DB: hc9
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 1
          Exec_Master_Log_Pos: 106
              Relay_Log_Space: 106
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: Yes
           Master_SSL_CA_File: 60
           Master_SSL_CA_Path: 0
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 2003
                Last_IO_Error: error connecting to master '[email protected]:5595'                                                                                                                - retry-time: 0  retries: 86400
               Last_SQL_Errno: 0
               Last_SQL_Error:
1 row in set (0.00 sec)
已经授权了 

解决方案 »

  1.   

    1、在A机器上直接登录MYSQL,然后SHOW VARIABLES LIKE '%PORT%',看看用的是哪个端口。或者在配置文件的MYSQLD下的PORT参数,看下是多少,如果不是3306,那么你B里指定的MASTER的端口肯定就是错误的。 2、确定能够登录A本机后,看下同步账号的权限是否足够
     mysql> show grants for '同步账号'; 3、在B机登录A机,通过同步账号这个账号。 4、在B机上操作1,2,3步,确定都正常。
     5、在my.cnf(INI)中是否有bind-address=127.0.0.1,如有,去掉。
      

  2.   

    bind-address=127.0.0.1  这个 在做 master、slave时具体起到什么作用啊   大侠
      

  3.   

    mysql> show slave status\G
    *************************** 1. row ***************************
                   Slave_IO_State:
                      Master_Host: 10.10.10.2
    现在是 这里 Slave_IO_State:      老是 空的  不管我 启动了 slave 还是没有启动。
    其他都没有问题 
       防火墙、bind-address=127.0.0.1、
    mysql> show grants for 'tongbu'@'10.10.10.5';
    +-------------------------------------------------------------------------------------------------------------------------------------------+
    | Grants for [email protected]                                                                                                              |
    +-------------------------------------------------------------------------------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'tongbu'@'10.10.10.5' IDENTIFIED BY PASSWORD '*8B92DE6FD7FF34D1697AE23187B488DD057B8D41' WITH GRANT OPTION |
    +-------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
      

  4.   


    mysql> show slave status\G
    *************************** 1. row ***************************
                   Slave_IO_State:
                      Master_Host: 10.10.10.2
                      Master_User: tongbu
                      Master_Port: 5595
                    Connect_Retry: 0
                  Master_Log_File: mysql-bin.000032
              Read_Master_Log_Pos: 106
                   Relay_Log_File: mysqld-relay-bin.000003
                    Relay_Log_Pos: 4
            Relay_Master_Log_File: mysql-bin.000032
                 Slave_IO_Running: No
                Slave_SQL_Running: Yes
                  Replicate_Do_DB: hc9
              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: 106
                  Relay_Log_Space: 106
                  Until_Condition: None
                   Until_Log_File:
                    Until_Log_Pos: 0
               Master_SSL_Allowed: Yes
               Master_SSL_CA_File: 60
               Master_SSL_CA_Path: 0
                  Master_SSL_Cert:
                Master_SSL_Cipher:
                   Master_SSL_Key:
            Seconds_Behind_Master: NULL
    Master_SSL_Verify_Server_Cert: No
                    Last_IO_Errno: 2003
                    Last_IO_Error: error connecting to master '[email protected]:5595' - retry-time: 0  retries: 86400
                   Last_SQL_Errno: 0
                   Last_SQL_Error:
    1 row in set (0.00 sec)