zoukankan      html  css  js  c++  java
  • Last_IO_Errno: 1062

    主键冲突的错误 1062
     
    模拟错误:
     
    在主库上操作:
    create table test100(id int not null,name varchar(20),primary key(id));
    insert into test100 (id,name) values(100,'lianggj');
     
    在从库上操作:
    insert into test100 (id,name) values(200,'guo');
     
     
    在主库上操作:
    insert into test100 (id,name) values(200,'guo');
     
     
     
     
    mysql> show slave status G;
    *************************** 1. row ***************************
                   Slave_IO_State: Waiting for master to send event
                      Master_Host: 192.168.56.56
                      Master_User: repl
                      Master_Port: 3306
                    Connect_Retry: 60
                  Master_Log_File: mysql-bin.000002
              Read_Master_Log_Pos: 955
                   Relay_Log_File: relay-bin.000006
                    Relay_Log_Pos: 897
            Relay_Master_Log_File: mysql-bin.000002
                 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: Could not execute Write_rows event on table lgj3306.test100; Duplicate entry '200' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000002, end_log_pos 924
                     Skip_Counter: 0
              Exec_Master_Log_Pos: 684
                  Relay_Log_Space: 1456
                  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: 0
                    Last_IO_Error: 
                   Last_SQL_Errno: 1062
                   Last_SQL_Error: Could not execute Write_rows event on table lgj3306.test100; Duplicate entry '200' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000002, end_log_pos 924
      Replicate_Ignore_Server_Ids: 
                 Master_Server_Id: 563306
                      Master_UUID: 3c1ec304-e17d-11e6-9f17-080027746853
                 Master_Info_File: /data/mysql/3306/data/master.info
                        SQL_Delay: 0
              SQL_Remaining_Delay: NULL
          Slave_SQL_Running_State: 
               Master_Retry_Count: 86400
                      Master_Bind: 
          Last_IO_Error_Timestamp: 
         Last_SQL_Error_Timestamp: 170124 12:26:56
                   Master_SSL_Crl: 
               Master_SSL_Crlpath: 
               Retrieved_Gtid_Set: 3c1ec304-e17d-11e6-9f17-080027746853:1-8
                Executed_Gtid_Set: 3c1ec304-e17d-11e6-9f17-080027746853:1-7,
    e4602c16-e1db-11e6-9277-080027cc764c:1
                    Auto_Position: 1
             Replicate_Rewrite_DB: 
                     Channel_Name: 
               Master_TLS_Version:
     
    解决思路:
    以主库的为准,把从库上重复的数据删掉。
     
    错误解决:
    set sql_log_bin=0;
    delete from  xxx;
    set sql_log_bin=1;
    start slave sql_thread;
     
     
  • 相关阅读:
    通过Form添加数据到数据库里
    如何取消服务器/主机空间目录脚本的执行权限
    一个人的网站开发
    3.1.2 新版视频教程震撼发布(30集)
    P类问题,NP,NPC,HPHard,coNP,NPI问题 的简单认识
    随机算法与近似算法
    python to exe
    ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
    anaconda + pyqt5 + pycharm 安装,测试
    C++ 结构体初始化
  • 原文地址:https://www.cnblogs.com/liang545621/p/7518403.html
Copyright © 2011-2022 走看看