我的mysql版本:
[root@cancer ~]# rpm -qa|grep My
MySQL-shared-5.5.11-1.linux2.6
MySQL-devel-5.5.11-1.linux2.6
MySQL-embedded-5.5.11-1.linux2.6
MySQL-test-5.5.11-1.linux2.6
MySQL-server-5.5.11-1.linux2.6
MySQL-client-5.5.11-1.linux2.6
MySQL-shared-compat-5.5.11-1.linux2.6
[root@cancer ~]#
同步设置:主服务器:172.16.20.1 从服务器:172.16.20.2
1.主服务器上创建同步账户,修改my.cnf;重启,锁表,mysqldump导出数据库destoon;
2.从服务器上导入数据源destoon,修改my.cnf,重启mysql,登录change master...加入主服务器信息,slave start之后,show slave status\G;显示信息如下:
mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Connecting to master
                  Master_Host: 172.16.20.1
                  Master_User: repliword
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File:
          Read_Master_Log_Pos: 4
               Relay_Log_File: mysql-relay-bin.000002
                Relay_Log_Pos: 4
        Relay_Master_Log_File:
             Slave_IO_Running: Connecting
            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: 0
              Relay_Log_Space: 107
              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
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 2003
                Last_IO_Error: error connecting to master '[email protected]                                                                             :3306' - retry-time: 60  retries: 86400
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 0
1 row in set (0.00 sec)
重新reset slave,在加入master信息还是不行;
这时主服务执行
mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
| 37 | root | localhost | NULL | Query   |    0 | NULL  | show processlist |
+----+------+-----------+------+---------+------+-------+------------------+
1 row in set (0.00 sec)
从服务器显示:
mysql> show processlist;
+----+-------------+-----------+-------+---------+------+-----------------------------------------------------------------------------+------------------+
| Id | User        | Host      | db    | Command | Time | State                                                                       | Info             |
+----+-------------+-----------+-------+---------+------+-----------------------------------------------------------------------------+------------------+
| 19 | root        | localhost | smmdb | Query   |    0 | NULL                                                                        | show processlist |
| 22 | system user |           | NULL  | Connect |  513 | Connecting to master                                                        | NULL             |
| 23 | system user |           | NULL  | Connect |  513 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL             |
+----+-------------+-----------+-------+---------+------+-----------------------------------------------------------------------------+------------------+从服务器log:
110905  1:06:32 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.003910', position 9407
110905  1:06:36 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='172.16.20.1', master_port='3306', master_log_file='mysql-bin.003910', master_log_pos='9407'. New state master_host='172.16.20.1', master_port='3306', master_log_file='mysql-bin.003910', master_log_pos='9407'.
110905  1:06:40 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.003910' at position 9407, relay log './mysql-relay-bin.000001' position: 4
110905  1:06:43 [ERROR] Slave I/O: error connecting to master '[email protected]:3306' - retry-time: 60  retries: 86400, Error_code: 2003
110905  1:38:09 [Warning] IP address '219.148.38.10' could not be resolved: no reverse address mapping.哎呀,我实在不知道怎么做了,已经搞了一周了各位大侠帮我看看,分送上
110905  1:46:20 [Note] Error reading relay log event: slave SQL thread was killed
110905  1:46:20 [Note] Slave I/O thread killed while connecting to master
110905  1:46:20 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.003910', position 9407

解决方案 »

  1.   

    应该是没有权限  重新在master上设置一下复制权限
      

  2.   

    恩,mysql数据库同步时,有些是把主服务器的信息写在配置文档my.cnf中,有的直接登录mysql执行‘change master’我有点搞不清楚
      

  3.   

    先授权,主库与从库还没连接上呢。主库先允许从库与其同步。然后,从库再chang注意日志点。