{"id":743,"date":"2026-01-29T06:45:14","date_gmt":"2026-01-29T06:45:14","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=743"},"modified":"2026-01-29T06:45:32","modified_gmt":"2026-01-29T06:45:32","slug":"mysql8-1396%e9%94%99%e8%af%af%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=743","title":{"rendered":"MySQL8 1396\u9519\u8bef\u5904\u7406"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>Last_SQL_Errno: 1396\n               Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'c5d67684-fcd5-11f0-b41d-02420a4e7d02:7' at master log mysql-bin.000002, end_log_pos 3117452. See error log and\/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.<\/code><\/pre>\n\n\n\n<p>\u4f60\u73b0\u5728\u660e\u786e\u770b\u5230\u4e86 Last_SQL_Errno: 1396 \u7684\u9519\u8bef\uff0c\u7ed3\u5408 GTID \u4e3b\u4ece\u590d\u5236\u7684\u573a\u666f\uff0c\u8fd9\u4e2a 1396 \u9519\u8bef\u7801\u7684\u6838\u5fc3\u542b\u4e49\u662f<strong>\u4ece\u5e93\u6267\u884c\u7528\u6237\u76f8\u5173\u7684\u64cd\u4f5c\uff08\u5982\u521b\u5efa \/ \u4fee\u6539\u7528\u6237\u3001\u6388\u6743\uff09\u5931\u8d25<\/strong>\uff0c\u5bfc\u81f4\u5bf9\u5e94 GTID \u4e8b\u52a1\uff08c5d67684-fcd5-11f0-b41d-02420a4e7d02:7\uff09\u65e0\u6cd5\u5e94\u7528\uff0c\u6700\u7ec8\u89e6\u53d1 Coordinator \u505c\u6b62\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5148\u5b9a\u4f4d 1396 \u9519\u8bef\u7684\u5177\u4f53\u539f\u56e0<\/h3>\n\n\n\n<p>\u9996\u5148\u9700\u8981\u7cbe\u51c6\u627e\u5230\u8fd9\u4e2a\u4e8b\u52a1\u5230\u5e95\u6267\u884c\u4e86\u4ec0\u4e48\u7528\u6237\u64cd\u4f5c\u5bfc\u81f4\u5931\u8d25\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT WORKER_ID, LAST_ERROR_NUMBER, LAST_ERROR_MESSAGE, LAST_ERROR_TIMESTAMP FROM performance_schema.replication_applier_status_by_worker\\G;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/image-120-1024x341.png\" alt=\"\" class=\"wp-image-745\" srcset=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/image-120-1024x341.png 1024w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/image-120-300x100.png 300w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/image-120-768x255.png 768w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/image-120-1536x511.png 1536w, https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/image-120.png 1894w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>1396 \u9519\u8bef\u7684\u5e38\u89c1\u5177\u4f53\u573a\u666f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e3b\u5e93\u6267\u884c\u4e86 <code>CREATE USER 'xxx'@'%'<\/code>\uff0c\u4f46\u4ece\u5e93\u5df2\u5b58\u5728\u540c\u540d\u7528\u6237\uff1b<\/li>\n\n\n\n<li>\u4e3b\u5e93\u6267\u884c\u4e86 <code>ALTER USER 'xxx'@'%' IDENTIFIED BY 'xxx'<\/code>\uff0c\u4f46\u4ece\u5e93\u8be5\u7528\u6237\u4e0d\u5b58\u5728 \/ \u6743\u9650\u4e0d\u8db3\uff1b<\/li>\n\n\n\n<li>\u4e3b\u5e93\u6267\u884c\u4e86 <code>DROP USER 'xxx'@'%'<\/code>\uff0c\u4f46\u4ece\u5e93\u65e0\u8be5\u7528\u6237\uff1b<\/li>\n\n\n\n<li>\u4ece\u5e93\u7684 root \u7528\u6237\u6743\u9650\u4e0d\u8db3\uff0c\u65e0\u6cd5\u6267\u884c\u4e3b\u5e93\u7684\u7528\u6237\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u9488\u5bf9 1396 \u9519\u8bef\u7684\u4fee\u590d\u65b9\u6848\uff08GTID \u6a21\u5f0f\uff09<\/h3>\n\n\n\n<p>\u5982\u679c\u786e\u8ba4\u8be5\u7528\u6237\u64cd\u4f5c\u5bf9\u4ece\u5e93\u65e0\u5f71\u54cd\uff08\u6bd4\u5982\u4e3b\u5e93\u8bef\u521b\u5efa\u6d4b\u8bd5\u7528\u6237\uff09\uff0c\u53ef\u76f4\u63a5\u8df3\u8fc7\u8be5 GTID \u4e8b\u52a1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- 1. \u505c\u6b62\u590d\u5236\nSTOP SLAVE;\n\n-- 2. \u6307\u5b9a\u8981\u8df3\u8fc7\u7684 GTID \u4e8b\u52a1\uff08\u66ff\u6362\u4e3a\u62a5\u9519\u7684 GTID\uff09\nSET GTID_NEXT = 'c5d67684-fcd5-11f0-b41d-02420a4e7d02:7';\n\n-- 3. \u6267\u884c\u7a7a\u4e8b\u52a1\uff08\u8ba9\u4ece\u5e93\u8ba4\u4e3a\u8be5 GTID \u5df2\u6267\u884c\uff09\nBEGIN; COMMIT;\n\n-- 4. \u6062\u590d GTID \u81ea\u52a8\u5206\u914d\nSET GTID_NEXT = 'AUTOMATIC';\n\n-- 5. \u91cd\u542f\u590d\u5236\nSTART SLAVE;\n\n-- 6. \u68c0\u67e5\u4fee\u590d\u7ed3\u679c\uff08\u6838\u5fc3\u770b Slave_SQL_Running \u662f\u5426\u4e3a Yes\uff09\nSHOW SLAVE STATUS\\G;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u73b0\u5728\u660e\u786e\u770b\u5230\u4e86 Last_SQL_Errno: 1396 \u7684\u9519\u8bef\uff0c\u7ed3\u5408 GTID \u4e3b\u4ece\u590d\u5236\u7684\u573a\u666f\uff0c\u8fd9\u4e2a 1396 \u9519\u8bef\u7801\u7684\u6838\u5fc3\u542b\u4e49\u662f\u4ece\u5e93\u6267\u884c\u7528\u6237\u76f8\u5173\u7684\u64cd\u4f5c\uff08\u5982\u521b\u5efa \/ \u4fee\u6539\u7528\u6237\u3001\u6388\u6743\uff09\u5931\u8d25\uff0c\u5bfc\u81f4\u5bf9\u5e94 GTID \u4e8b\u52a1\uff08c5d67684-fcd5-11f0-b41d-02420a4e7d02:7\uff09\u65e0\u6cd5\u5e94\u7528\uff0c\u6700\u7ec8\u89e6\u53d1 Coordinator \u505c\u6b62\u3002 \u5148\u5b9a\u4f4d 1396 \u9519\u8bef\u7684\u5177\u4f53\u539f\u56e0 \u9996\u5148\u9700\u8981\u7cbe\u51c6\u627e\u5230\u8fd9\u4e2a\u4e8b\u52a1\u5230\u5e95\u6267\u884c\u4e86\u4ec0\u4e48\u7528\u6237\u64cd\u4f5c\u5bfc\u81f4\u5931\u8d25\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a 1396 \u9519\u8bef\u7684\u5e38\u89c1\u5177\u4f53\u573a\u666f\uff1a \u9488\u5bf9 1396 \u9519\u8bef\u7684\u4fee\u590d\u65b9\u6848\uff08GTID \u6a21\u5f0f\uff09 \u5982\u679c\u786e\u8ba4\u8be5\u7528\u6237\u64cd\u4f5c\u5bf9\u4ece\u5e93\u65e0\u5f71\u54cd\uff08\u6bd4\u5982\u4e3b\u5e93\u8bef\u521b\u5efa\u6d4b\u8bd5\u7528\u6237\uff09\uff0c\u53ef\u76f4\u63a5\u8df3\u8fc7\u8be5 GTID \u4e8b\u52a1\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-743","post","type-post","status-publish","format-standard","hentry","category-8"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=743"}],"version-history":[{"count":1,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/743\/revisions"}],"predecessor-version":[{"id":747,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/743\/revisions\/747"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}