+ -
当前位置:首页 → 问答吧 → mysql主从复制,Last_Error:Error 'Duplicate entry '%-test-'。。。

mysql主从复制,Last_Error:Error 'Duplicate entry '%-test-'。。。

时间:2010-10-12

来源:互联网

本帖最后由 轻逐微风 于 2010-10-12 09:46 编辑

mysql> show slave status\G;
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 192.168.1.31
                Master_User: slave
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000006
        Read_Master_Log_Pos: 308
             Relay_Log_File: localhost-relay-bin.000002
              Relay_Log_Pos: 13476
      Relay_Master_Log_File: mysql-bin.000001
           Slave_IO_Running: Yes
          Slave_SQL_Running: No
            Replicate_Do_DB:
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 1062
                 Last_Error: Error 'Duplicate entry '%-test-' for key 1' on quer                                                                                                
y. Default database: 'mysql'. Query: 'INSERT INTO db SELECT * FROM tmp_db WHERE   
@had_db_table=0'
               Skip_Counter: 0
        Exec_Master_Log_Pos: 13339
            Relay_Log_Space: 645619
            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

  1. 如何解决呢?
  2. Last_Error: Error 'Duplicate entry '%-test-' for key 1' on quer                                                                                                
  3. y. Default database: 'mysql'. Query: 'INSERT INTO db SELECT * FROM tmp_db WHERE   
  4. @had_db_table=0'
复制代码

作者: 轻逐微风   发布时间: 2010-10-12

没有搞过mysql的集群阿。

作者: renxiao2003   发布时间: 2010-10-12

回复 轻逐微风

解决办法:   

mysql> STOP SLAVE;


mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;


mysql> START SLAVE;


原文:http://www.howtoforge.com/how-to-repair-mysql-replication

作者: 轻逐微风   发布时间: 2010-10-12