﻿{"id":460,"date":"2017-08-29T18:01:48","date_gmt":"2017-08-29T10:01:48","guid":{"rendered":"http:\/\/www.chenweikang.top\/?p=460"},"modified":"2017-08-29T18:01:48","modified_gmt":"2017-08-29T10:01:48","slug":"%e8%a7%a3%e5%86%b3mysql%e4%b8%bb%e4%bb%8e%e5%90%8c%e6%ad%a5last_error-error-duplicate-entry","status":"publish","type":"post","link":"https:\/\/www.chenweikang.top\/?p=460","title":{"rendered":"\u89e3\u51b3mysql\u4e3b\u4ece\u540c\u6b65Last_Error: Error 'Duplicate entry'"},"content":{"rendered":"<h2>\u5728myslq\u4e3b\u4ece\u540c\u6b65\u65f6\uff0c\u4e3b\u5e93\u6210\u529f\u5f00\u542fmaster\u670d\u52a1\uff0c\u5e76\u5c06\u4ece\u5e93\u7684master_log_pos=19500\u4fdd\u6301\u4e0e\u4e3b\u5e93\u76f8\u540c<\/h2>\n<pre class=\"prettyprint linenums\">mysql&gt; show master status\\G\r\n*************************** 1. row ***************************\r\n File: mysql-bin.000002\r\n Position: 19500\r\n Binlog_Do_DB: hms\r\nBinlog_Ignore_DB: information_schema,mysql,yunbao_db\r\n1 row in set (0.00 sec)\r\n<\/pre>\n<h3>\u5728\u542f\u52a8\u4ece\u5e93salve\u670d\u52a1\u65f6\u62a5\u9519\uff1a<\/h3>\n<pre class=\"prettyprint linenums\">mysql&gt; show slave status\\G\r\n*************************** 1. row ***************************\r\n               Slave_IO_State: Waiting for master to send event\r\n                  Master_Host: 10.25.199.52\r\n                  Master_User: slaveuser\r\n                  Master_Port: 3306\r\n                Connect_Retry: 60\r\n              Master_Log_File: mysql-bin.000002\r\n          Read_Master_Log_Pos: 19500\r\n               Relay_Log_File: iZ25fn41e46Z-relay-bin.000004\r\n                Relay_Log_Pos: 253\r\n        Relay_Master_Log_File: mysql-bin.000002\r\n             Slave_IO_Running: Yes\r\n            Slave_SQL_Running: No\r\n              Replicate_Do_DB: hms\r\n          Replicate_Ignore_DB: information_schema,mysql,shopxx,yunbao_web_db,chni_web_db\r\n           Replicate_Do_Table: \r\n       Replicate_Ignore_Table: \r\n      Replicate_Wild_Do_Table: \r\n  Replicate_Wild_Ignore_Table: \r\n                   Last_Errno: 1062\r\n                   Last_Error: Error 'Duplicate entry '0070900000247' for key 'PRIMARY'' on query. Default database: 'hms'. Query: 'insert into cus_customer (address, ascount, asstate, birthday, blid, bodycheckid, bodycheckname, cardtypeid, checkbodydata, citid, createtime, createuserid, CTypeId, cus_sou_device, cus_source, cuserid, cusername, cusstate, customername, cyid, directoruserid, directorusername...\r\n    Skip_Counter: 0\r\n          Exec_Master_Log_Pos: 107\r\n              Relay_Log_Space: 21614\r\n              Until_Condition: None\r\n               Until_Log_File: \r\n                Until_Log_Pos: 0\r\n           Master_SSL_Allowed: No\r\n           Master_SSL_CA_File: \r\n           Master_SSL_CA_Path: \r\n              Master_SSL_Cert: \r\n            Master_SSL_Cipher: \r\n               Master_SSL_Key: \r\n        Seconds_Behind_Master: NULL\r\nMaster_SSL_Verify_Server_Cert: No\r\n                Last_IO_Errno: 0\r\n                Last_IO_Error: \r\n               Last_SQL_Errno: 1062\r\n......\r\n<\/pre>\n<h3>\u5206\u6790\u64cd\u4f5c\u6b65\u9aa4\uff0c\u67e5\u770b\u5230\u00a0Relay_Log_Pos\u7684\u503c\u4e0e\u00a0Read_Master_Log_Pos \u76f8\u5dee\u8f83\u5927<\/h3>\n<p><a href=\"http:\/\/www.chenweikang.top\/wp-content\/uploads\/2017\/08\/mysql-slave.png\" class=\"gallery_colorbox\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-461\" src=\"http:\/\/www.chenweikang.top\/wp-content\/uploads\/2017\/08\/mysql-slave.png\"  alt=\"\" width=\"1080\" height=\"526\" srcset=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2017\/08\/mysql-slave.png 1080w, https:\/\/www.chenweikang.top\/wp-content\/uploads\/2017\/08\/mysql-slave-300x146.png 300w, https:\/\/www.chenweikang.top\/wp-content\/uploads\/2017\/08\/mysql-slave-768x374.png 768w, https:\/\/www.chenweikang.top\/wp-content\/uploads\/2017\/08\/mysql-slave-1024x499.png 1024w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/p>\n<p><span style=\"color: #800000;\">\u53ef\u4ee5\u5224\u65ad\u7531\u4e8e\u4ece\u5e93\u542f\u52a8\u540e\u4ece\u00a0Relay_Log_Pos \u4f4d\u7f6e\u8bfb\u53d6\u65e5\u5fd7\u5411\u4ece\u5e93\u5199\u5165\uff0c\u800c\u4ece\u5e93\u5b9e\u9645\u4e0a\u6570\u636e\u5df2\u548c\u4e3b\u5e93\u540c\u6b65\uff0c\u5bfc\u81f4\u63d2\u5165\u91cd\u590d\u6570\u636e<\/span><\/p>\n<h3>\u89e3\u51b3\uff1a<br \/>\n\u91cd\u65b0\u8bbe\u7f6emaster_log_pos\u5373\u53ef<\/h3>\n<pre class=\"prettyprint linenums\">mysql&gt; stop slave\uff1b\r\nmysql&gt; change master to master_log_pos=19500\uff1b\r\nmysql&gt; start slave;\r\nmysql&gt; show slave status\\G\r\n*************************** 1. row ***************************\r\n Slave_IO_State: Waiting for master to send event\r\n Master_Host: 10.25.199.52\r\n Master_User: slaveuser\r\n Master_Port: 3306\r\n Connect_Retry: 60\r\n Master_Log_File: mysql-bin.000002\r\n Read_Master_Log_Pos: 20544\r\n Relay_Log_File: iZ25fn41e46Z-relay-bin.000002\r\n Relay_Log_Pos: 1297\r\n Relay_Master_Log_File: mysql-bin.000002\r\n Slave_IO_Running: Yes\r\n Slave_SQL_Running: Yes\r\n Replicate_Do_DB: hms\r\n Replicate_Ignore_DB: information_schema,mysql,shopxx,yunbao_web_db,chni_web_db\r\n Replicate_Do_Table: \r\n Replicate_Ignore_Table: \r\n Replicate_Wild_Do_Table: \r\n Replicate_Wild_Ignore_Table: \r\n Last_Errno: 0\r\n Last_Error: \r\n Skip_Counter: 0\r\n Exec_Master_Log_Pos: 20544\r\n Relay_Log_Space: 1460\r\n Until_Condition: None\r\n Until_Log_File: \r\n Until_Log_Pos: 0\r\n Master_SSL_Allowed: No\r\n Master_SSL_CA_File: \r\n Master_SSL_CA_Path: \r\n Master_SSL_Cert: \r\n Master_SSL_Cipher: \r\n Master_SSL_Key: \r\n Seconds_Behind_Master: 0\r\nMaster_SSL_Verify_Server_Cert: No\r\n Last_IO_Errno: 0\r\n Last_IO_Error: \r\n Last_SQL_Errno: 0\r\n Last_SQL_Error: \r\n Replicate_Ignore_Server_Ids: \r\n Master_Server_Id: 1\r\n1 row in set (0.00 sec)<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.chenweikang.top\">\u5de6\u624b\u4ee3\u7801\u53f3\u624b\u8bd7<\/a> &raquo; <a href=\"https:\/\/www.chenweikang.top\/?p=460\">\u89e3\u51b3mysql\u4e3b\u4ece\u540c\u6b65Last_Error: Error 'Duplicate entry'<\/a><\/p><div class=\"__youshang\">\r\n            <div id=\"__youshang_popup\" class=\"wechat popup\" style=\"display: none;\">\r\n                <div class=\"head\">~\u8c22\u8c22\u6253\u8d4f~<\/div>\r\n                <div class=\"qrcode\"><div class=\"qrcode-li wechat\" ><img src=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2019\/07\/wexin.png\" \/><\/div><div class=\"qrcode-li alipay\" style=\"display:none;\"><img src=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2019\/07\/ali-pay.png\" \/><\/div><div class=\"qrcode-li hongbao\" style=\"display:none;\"><img src=\"https:\/\/www.chenweikang.top\/wp-content\/uploads\/2019\/07\/ali-hongbao.png\" \/><\/div><\/div>\r\n                <ul class=\"platform\"><li class=\"icon-wechat active\" data-bg-color=\"#05af4e\" data-thanks=\"~\u8c22\u8c22\u6253\u8d4f~\"><\/li><li class=\"icon-alipay \" data-bg-color=\"#00a2ea\" data-thanks=\"~\u8c22\u8c22\u6253\u8d4f~\"><\/li><li class=\"icon-hongbao \" data-bg-color=\"#dd5746\" data-thanks=\"<p>\u626b\u7801\u9886\u7ea2\u5305<\/p><p style='margin-top: 24px;'>\uff08\u4f59\u989d\u5b9d\u652f\u4ed8\u65f6\u53ef\u62b5\u73b0\uff09<\/p>\"><\/li><\/ul>\r\n            <\/div>\r\n            <a href=\"javascript:void(0);\" id=\"__youshang_btn\">\u8d4f<\/a>\r\n        <\/div>","protected":false},"excerpt":{"rendered":"<p>\u5728myslq\u4e3b\u4ece\u540c\u6b65\u65f6\uff0c\u4e3b\u5e93\u6210\u529f\u5f00\u542fmaster\u670d\u52a1\uff0c\u5e76\u5c06\u4ece\u5e93\u7684master_log_pos=19500\u4fdd\u6301\u4e0e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,6],"tags":[45],"class_list":["post-460","post","type-post","status-publish","format-standard","hentry","category-database","category-suibi","tag-45"],"_links":{"self":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/posts\/460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=460"}],"version-history":[{"count":0,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=\/wp\/v2\/posts\/460\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenweikang.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}