{"id":209823,"date":"2022-08-20T03:00:17","date_gmt":"2022-08-19T19:00:17","guid":{"rendered":"https:\/\/www.keaglegz.com\/209823.html"},"modified":"2026-07-15T06:48:18","modified_gmt":"2026-07-14T22:48:18","slug":"mysql%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%97%a5%e5%bf%97%e6%81%a2%e5%a4%8d%e6%95%b0%e6%8d%ae%e6%8a%a5%e9%94%99%ef%bc%9aglobal-gtid_mode","status":"publish","type":"post","link":"https:\/\/www.dongwubaike.cn\/fanhao\/209823.html","title":{"rendered":"MySQL\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6062\u590d\u6570\u636e\u62a5\u9519\uff1a@@GLOBAL.GTID_MODE ="},"content":{"rendered":"\n<p>\u89e3\u51b3MySQL\u5229\u7528\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6062\u590d\u6570\u636e\u62a5\u9519\uff1aERROR 1781 (HY000) at line 16: @@SESSION.GTID_NEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTID_MODE = OFF.<\/p>\n<p><span style=\"background: yellow\">\u5de5\u4f5c\u4e2d\uff0c\u8fd0\u7528\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff0c\u5e2e\u5f00\u53d1\u7684\u540c\u4e8b\u6062\u590d\u6570\u636e\u65f6\uff0c\u51fa\u73b0\u4e86\u62a5\u9519\u544a\u8b66\uff1a<\/span><\/p>\n<div>\n<div>\n<div>\n<div><code>[root@localhost&nbsp;tmp]<\/code><code>#&nbsp;mysqlbinlog&nbsp;--no-defaults&nbsp;mysql-bin.000614|mysql&nbsp;-uroot&nbsp;-p<\/code><\/div>\n<div><code>Enter&nbsp;password:<\/code><\/div>\n<div><code>ERROR&nbsp;1781&nbsp;(HY000)&nbsp;at&nbsp;line&nbsp;16:&nbsp;@@SESSION.GTID_NEXT&nbsp;cannot&nbsp;be&nbsp;<\/code><code>set<\/code>&nbsp;<code>to&nbsp;UUID:NUMBER&nbsp;when&nbsp;@@GLOBAL.GTID_MODE&nbsp;=&nbsp;OFF.<\/code><\/div>\n<div><code>[root@localhost&nbsp;tmp]<\/code><code>#&nbsp;mysqlbinlog&nbsp;--no-defaults&nbsp;mysql-bin.000614|mysql&nbsp;-uroot&nbsp;-p<\/code><\/div>\n<div><code>Enter&nbsp;password:<\/code><\/div>\n<div><code>[root@localhost&nbsp;tmp]<\/code><code>#&nbsp;echo&nbsp;$?<\/code><\/div>\n<div><code>0<\/code><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p>\u670d\u52a1\u5668\u76f8\u5173\u73af\u5883\u53c2\u6570\uff1a<\/p>\n<p>\u670d\u52a1\u5668\u7cfb\u7edf\uff1aCentOS Linux release 7.3.1611 (Core)<\/p>\n<p><span style=\"color: red\">MySQL<\/span><span style=\"color: red\">\u7248\u672c\uff1a<\/span><\/p>\n<div>\n<div>\n<div>\n<div><code>mysql&gt;&nbsp;<\/code><code>select<\/code>&nbsp;<code>version();<\/code><\/div>\n<div><code>+<\/code><code>-----------+<\/code><\/div>\n<div><code>|&nbsp;version()&nbsp;|<\/code><\/div>\n<div><code>+<\/code><code>-----------+<\/code><\/div>\n<div><code>|&nbsp;5.7.13&nbsp; &nbsp; |<\/code><\/div>\n<div><code>+<\/code><code>-----------+<\/code><\/div>\n<div><code>1&nbsp;row&nbsp;<\/code><code>in<\/code>&nbsp;<code>set<\/code>&nbsp;<code>(0.00&nbsp;sec)<\/code>&nbsp;<\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p><span style=\"color: red\">\u89e3\u51b3\u529e\u6cd5\uff1a<\/span><\/p>\n<p>\u914d\u7f6egtid\u9009\u9879<\/p>\n<p><span style=\"color: red\">\u914d\u7f6e\u524d\uff1a<\/span><\/p>\n<div>\n<div>\n<div>\n<div><code>mysql&gt;&nbsp;show&nbsp;<\/code><code>global<\/code>&nbsp;<code>variables&nbsp;<\/code><code>like<\/code>&nbsp;<code>'gtid_mode'<\/code><code>;<\/code><\/div>\n<div><code>ERROR&nbsp;2006&nbsp;(HY000):&nbsp;MySQL&nbsp;server&nbsp;has&nbsp;gone&nbsp;away<\/code><\/div>\n<div><code>No<\/code>&nbsp;<code>connection<\/code><code>.&nbsp;Trying&nbsp;<\/code><code>to<\/code>&nbsp;<code>reconnect...<\/code><\/div>\n<div><code>Connection<\/code>&nbsp;<code>id:&nbsp; &nbsp; 24<\/code><\/div>\n<div><code>Current<\/code>&nbsp;<code>database<\/code><code>:&nbsp;gold<\/code><\/div>\n<div><code>+<\/code><code>---------------+-------+<\/code><\/div>\n<div><code>|&nbsp;Variable_name&nbsp;|&nbsp;Value&nbsp;|<\/code><\/div>\n<div><code>+<\/code><code>---------------+-------+<\/code><\/div>\n<div><code>|&nbsp;gtid_mode&nbsp; &nbsp; &nbsp;|&nbsp;<\/code><code>OFF<\/code>&nbsp; &nbsp;<code>|<\/code><\/div>\n<div><code>+<\/code><code>---------------+-------+<\/code><\/div>\n<div><code>1&nbsp;row&nbsp;<\/code><code>in<\/code>&nbsp;<code>set<\/code>&nbsp;<code>(0.10&nbsp;sec)<\/code>&nbsp;<\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p><span style=\"color: red\">\u914d\u7f6e\u540e\uff1a<\/span><\/p>\n<div>\n<div>\n<div>\n<div><code>mysql&gt;&nbsp;<\/code><code>set<\/code>&nbsp;<code>@@<\/code><code>GLOBAL<\/code><code>.GTID_MODE&nbsp;=&nbsp;<\/code><code>on<\/code><code>;<\/code><\/div>\n<div><code>ERROR&nbsp;1788&nbsp;(HY000):&nbsp;The&nbsp;value&nbsp;<\/code><code>of<\/code>&nbsp;<code>@@<\/code><code>GLOBAL<\/code><code>.GTID_MODE&nbsp;can&nbsp;<\/code><code>only<\/code>&nbsp;<code>be&nbsp;changed&nbsp;one&nbsp;step&nbsp;<\/code><code>at<\/code>&nbsp;<code>a&nbsp;<\/code><code>time<\/code><code>:&nbsp;<\/code><code>OFF<\/code>&nbsp;<code>&lt;-&gt;&nbsp;OFF_PERMISSIVE&nbsp;&lt;-&gt;&nbsp;ON_PERMISSIVE&nbsp;&lt;-&gt;&nbsp;<\/code><code>ON<\/code><code>.&nbsp;Also&nbsp;note&nbsp;that&nbsp;this&nbsp;value&nbsp;must&nbsp;be&nbsp;stepped&nbsp;up&nbsp;<\/code><code>or<\/code>&nbsp;<code>down&nbsp;simultaneously&nbsp;<\/code><code>on<\/code>&nbsp;<code>all<\/code>&nbsp;<code>servers.&nbsp;See&nbsp;the&nbsp;Manual&nbsp;<\/code><code>for<\/code>&nbsp;<code>instructions.<\/code><\/div>\n<div><code>mysql&gt;&nbsp;<\/code><code>set<\/code>&nbsp;<code>@@<\/code><code>GLOBAL<\/code><code>.GTID_MODE&nbsp;=&nbsp;OFF_PERMISSIVE;<\/code><\/div>\n<div><code>mysql&gt;&nbsp;show&nbsp;<\/code><code>global<\/code>&nbsp;<code>variables&nbsp;<\/code><code>like<\/code>&nbsp;<code>'gtid_mode'<\/code><code>;<\/code><\/div>\n<div><code>+<\/code><code>---------------+----------------+<\/code><\/div>\n<div><code>|&nbsp;Variable_name&nbsp;|&nbsp;Value&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<\/code><\/div>\n<div><code>+<\/code><code>---------------+----------------+<\/code><\/div>\n<div><code>|&nbsp;gtid_mode&nbsp; &nbsp; &nbsp;|&nbsp;OFF_PERMISSIVE&nbsp;|<\/code><\/div>\n<div><code>+<\/code><code>---------------+----------------+<\/code><\/div>\n<div><code>1&nbsp;row&nbsp;<\/code><code>in<\/code>&nbsp;<code>set<\/code>&nbsp;<code>(0.00&nbsp;sec)<\/code><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p>&nbsp;GTID\u76f8\u5173\u77e5\u8bc6\uff1a<\/p>\n<p>GTID(GlobalTransaction ID)\u662f\u5bf9\u4e8e\u4e00\u4e2a\u5df2\u63d0\u4ea4\u4e8b\u52a1\u7684\u7f16\u53f7\uff0c\u5e76\u4e14\u662f\u4e00\u4e2a\u5168\u5c40\u552f\u4e00\u7684\u7f16\u53f7\u3002GTID\u5b9e\u9645\u4e0a\u662f\u7531UUID+TID\u7ec4\u6210\u7684\u3002\u5176\u4e2dUUID\u662f\u4e00\u4e2aMySQL\u5b9e\u4f8b\u7684\u552f\u4e00\u6807\u8bc6\u3002TID\u4ee3\u8868\u4e86\u8be5\u5b9e\u4f8b\u4e0a\u5df2\u7ecf\u63d0\u4ea4\u7684\u4e8b\u52a1\u6570\u91cf\uff0c\u5e76\u4e14\u968f\u7740\u4e8b\u52a1\u63d0\u4ea4\u5355\u8c03\u9012\u589e\u3002<\/p>\n<p>MySQL5.6\u589e\u52a0\u4e86GTID\u590d\u5236\u3002<\/p>\n<p>\u4e00\u4e2a\u4e8b\u52a1\u5bf9\u5e94\u4e00\u4e2a\u552f\u4e00ID\u3002<\/p>\n<p>\u4e00\u4e2aGTID\u5728\u4e00\u4e2a\u670d\u52a1\u5668\u4e0a\u53ea\u4f1a\u6267\u884c\u4e00\u6b21\u3002<\/p>\n<p>GTID\u662f\u7528\u6765\u66ff\u4ee3\u4ee5\u524dclassic\u7684\u590d\u5236\u65b9\u6cd5\u3002<\/p>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<p>\u76f8\u5bf9\u4e8e\u884c\u590d\u5236\u6765\u8bb2\u6570\u636e\u5b89\u5168\u6027\u66f4\u9ad8\uff1b<\/p>\n<p>\u6545\u969c\u5207\u6362\u66f4\u7b80\u5355\uff1b<\/p>\n<p>GTID\u7684\u4f7f\u7528\u5c40\u9650\uff1a<\/p>\n<p>\u4e0d\u652f\u6301\u975e\u4e8b\u52a1\u5f15\u64ce\uff08\u4ece\u5e93\u62a5\u9519\uff0cstopslave; start slave; \u5ffd\u7565\uff09\uff1b<\/p>\n<p>\u4e0d\u652f\u6301create table &hellip; select \u8bed\u53e5\u590d\u5236\uff08\u4e3b\u5e93\u76f4\u63a5\u62a5\u9519\uff09\uff1b\u4e0d\u652f\u6301sql_slave_skip_counter\uff1b<\/p>\n<p>\u5bf9\u4e8ecreatetemporary table \u548cdrop temporary table\u8bed\u53e5\u4e0d\u652f\u6301\uff1b<\/p>\n<p>\u4e0d\u5141\u8bb8\u5728\u4e00\u4e2aSQL\u540c\u65f6\u66f4\u65b0\u4e00\u4e2a\u4e8b\u52a1\u5f15\u64ce\u548c\u975e\u4e8b\u52a1\u5f15\u64ce\u7684\u8868\uff1b<\/p>\n<p>\u5728\u4e00\u4e2a\u590d\u5236\u7ec4\u4e2d\uff0c\u5fc5\u987b\u8981\u6c42\u7edf\u4e00\u5f00\u542fCTID\u6216\u662f\u5173\u95edGTID\uff1b<\/p>\n<p>\u5f00\u542fDTID\u9700\u8981\u91cd\u542f\uff085.7\u4e2d\u53ef\u80fd\u4e0d\u9700\u8981\uff09\uff1b<\/p>\n<p>\u5f00\u542fDTID\u540e\uff0c\u5c31\u4e0d\u5728\u4f7f\u7528\u539f\u6765\u7684\u4f20\u7edf\u7684\u590d\u5236\u65b9\u5f0f\uff1b<\/p>\n<p>gtid\u548c\u975egtid\u7684mysql\u5b9e\u4f8b\u662f\u4e0d\u80fd\u590d\u5236\u6570\u636e\u7684\uff0c\u8981\u4e48\u90fd\u662fgtid\uff0c\u8981\u4e48\u90fd\u662f\u666e\u901a\u7684\uff1b<\/p>\n<p>\u66f4\u65b0\u975e\u4e8b\u52a1\u5f15\u64ce\u8868\uff0c\u5728\u540c\u4e00\u4e8b\u52a1\u4e2d\u66f4\u65b0\u4e8b\u52a1\u8868\u4e0e\u975e\u4e8b\u52a1\u8868\u5c06\u5bfc\u81f4\u591a\u4e2aGTIDs\u5206\u914d\u7ed9\u540c\u4e00\u4e8b\u52a1\uff1b<\/p>\n<p>\u4e34\u65f6\u8868\uff0c\u4e8b\u52a1\u5185\u90e8\u4e0d\u80fd\u6267\u884c\u521b\u5efa\u5220\u9664\u4e34\u65f6\u8868\u8bed\u53e5\uff0c\u4f46\u53ef\u4ee5\u5728\u4e8b\u52a1\u5916\u6267\u884c\uff0c\u4f46\u5fc5\u987b\u8bbe\u7f6eset autocommit = 1\uff1b<\/p>\n<p>CREATE TABLE &hellip; SELECTstatements<\/p>\n<p>\u4e0d\u5b89\u5168\u7684\u57fa\u4e8e\u8bed\u53e5\u590d\u5236\uff0c\u5b9e\u9645\u662f\u4e24\u4e2a\u72ec\u7acb\u7684\u4e8b\u4ef6\uff0c\u4e00\u4e2a\u7528\u4e8e\u5efa\u8868\uff0c\u4e00\u4e2a\u7528\u4e8e\u5411\u65b0\u8868\u63d2\u5165\u6e90\u8868\u6570\u636e\u3002<\/p>\n<p>\u4e0d\u6267\u884c\u4e0d\u652f\u6301\u7684\u8bed\u53e5<\/p>\n<p>\u542f\u7528&#8211;enforce-gtid-consistency\u9009\u9879\u542f\u52a8GTID\u6a21\u5f0f\uff0c\u4e0a\u8ff0\u4e0d\u652f\u6301\u7684\u8bed\u53e5\u5c06\u4f1a\u8fd4\u56de\u9519\u8bef\u3002<\/p>\n<p><span style=\"font-size: small\"><strong>\u672c\u6587\u6c38\u4e45\u66f4\u65b0\u94fe\u63a5\u5730\u5740<\/strong><\/span>\uff1ahttp:\/\/www.linuxidc.com\/Linux\/2018-01\/150123.htm<\/p>\n<p><a href=\"https:\/\/www.dongwubaike.cn\/fanhao\/wp-content\/uploads\/2024\/06\/haode2332337.jpg\" data-fancybox=\"images\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dongwubaike.cn\/fanhao\/wp-content\/uploads\/2024\/06\/haode2332337.jpg\" width=\"15\" height=\"17\" alt=\"MySQL\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6062\u590d\u6570\u636e\u62a5\u9519\uff1a@@GLOBAL.GTID_MODE =\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u51b3MySQL\u5229\u7528\u4e8c\u8fdb\u5236\u65e5\u5fd7\u6062\u590d\u6570\u636e\u62a5\u9519\uff1aERROR 1781 (HY000) at line 16: @@SESSION.GTID_NEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTID_MODE = OFF.<\/p>\n","protected":false},"author":1,"featured_media":209821,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-209823","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/209823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/comments?post=209823"}],"version-history":[{"count":1,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/209823\/revisions"}],"predecessor-version":[{"id":308308,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/209823\/revisions\/308308"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/media\/209821"}],"wp:attachment":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/media?parent=209823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/categories?post=209823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/tags?post=209823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}