{"id":2467,"date":"2018-02-02T11:40:11","date_gmt":"2018-02-02T03:40:11","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2467"},"modified":"2018-02-02T11:40:11","modified_gmt":"2018-02-02T03:40:11","slug":"%e8%af%a6%e8%a7%a3%e4%bd%bf%e7%94%a8mysql%e7%9a%84binlog%ef%bc%88%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%97%a5%e5%bf%97%ef%bc%89%e6%81%a2%e5%a4%8d%e6%95%b0%e6%8d%ae%e7%9a%84%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2467","title":{"rendered":"\u8be6\u89e3\u4f7f\u7528MySQL\u7684binlog\uff08\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff09\u6062\u590d\u6570\u636e\u7684\u6559\u7a0b"},"content":{"rendered":"<p>\n\t\u8fde\u7eed3\u7bc7\u8bb2\u89e3binlog\u3002\u6062\u590d\u662fbinlog\u7684\u4e24\u5927\u4e3b\u8981\u4f5c\u7528\u4e4b\u4e00\uff0c\u63a5\u4e0b\u6765\u901a\u8fc7\u5b9e\u4f8b\u6f14\u793a\u5982\u4f55\u5229\u7528binlog\u6062\u590d\u6570\u636e\uff1a\n<\/p>\n<p>\n\t\u9996\u5148\uff0c\u770b\u4e0b\u5f53\u524dbinlog\u7684\u4f4d\u7f6e\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nmysql&gt; show master status;\r\n+------------------+----------+--------------+------------------+-------------------+\r\n| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |\r\n+------------------+----------+--------------+------------------+-------------------+\r\n| mysql-bin.000008 |     1847 |              |                  |                   |\r\n+------------------+----------+--------------+------------------+-------------------+<\/pre>\n<p>\n\t\u63a5\u7740\u60f3\u6d4b\u8bd5\u8868tb_person\u4e2d\u63d2\u5165\u4e24\u6761\u8bb0\u5f55\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\ninsert into tb_person  set name=&quot;person_1&quot;, address=&quot;beijing&quot;, sex=&quot;man&quot;, other=&quot;test-1&quot;;\r\ninsert into tb_person  set name=&quot;person_2&quot;, address=&quot;beijing&quot;, sex=&quot;man&quot;, other=&quot;test-2&quot;;<\/pre>\n<p>\n\t\u8bb0\u5f55\u5f53\u524dbinlog\u4f4d\u7f6e\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nmysql&gt; show master status;\r\n+------------------+----------+--------------+------------------+-------------------+\r\n| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |\r\n+------------------+----------+--------------+------------------+-------------------+\r\n| mysql-bin.000008 |     2585 |              |                  |                   |\r\n+------------------+----------+--------------+------------------+-------------------+<\/pre>\n<p>\n\t\u67e5\u8be2\u6570\u636e\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nmysql&gt; select *  from tb_person where name =&quot;person_2&quot; or name=&quot;person_1&quot;;\r\n+----+----------+---------+-----+--------+\r\n| id | name     | address | sex | other  |\r\n+----+----------+---------+-----+--------+\r\n|  6 | person_1 | beijing | man | test-1 |\r\n|  7 | person_2 | beijing | man | test-2 |\r\n+----+----------+---------+-----+--------+<\/pre>\n<p>\n\t\u5220\u9664\u4e00\u6761\u6570\u636e\u3002\n<\/p>\n<pre class=\"brush:sql;\">\r\nmysql&gt; select *  from tb_person where name =&quot;person_2&quot; or name=&quot;person_1&quot;;\r\n+----+----------+---------+-----+--------+\r\n| id | name     | address | sex | other  |\r\n+----+----------+---------+-----+--------+\r\n|  6 | person_1 | beijing | man | test-1 |\r\n+----+----------+---------+-----+--------+<\/pre>\n<p>\n\tbinlog\u6062\u590d\uff08\u6307\u5b9apos\u70b9\u6062\u590d\/\u90e8\u5206\u6062\u590d\uff09\n<\/p>\n<pre class=\"brush:sql;\">\r\nmysqlbinlog   --start-position=1847  --stop-position=2585  mysql-bin.000008  &gt; test.sql\r\nmysql&gt; source \/var\/lib\/mysql\/3306\/test.sql<\/pre>\n<p>\n\t\u6570\u636e\u6062\u590d\u5b8c\u6210\u540e\u67e5\u8be2\u9a8c\u8bc1\u4e00\u4e0b\u3002\n<\/p>\n<pre class=\"brush:sql;\">\r\nmysql&gt; select *  from tb_person where name =&quot;person_2&quot; or name=&quot;person_1&quot;;\r\n+----+----------+---------+-----+--------+\r\n| id | name     | address | sex | other  |\r\n+----+----------+---------+-----+--------+\r\n|  6 | person_1 | beijing | man | test-1 |\r\n|  7 | person_2 | beijing | man | test-2 |\r\n+----+----------+---------+-----+--------+<\/pre>\n<p>\n\tbinlog\u6062\u590d\u6570\u636e\uff0c\u5c31\u662f\u8ba9mysql\u5c06\u4fdd\u5b58\u5728binlog\u65e5\u5fd7\u4e2d\u6307\u5b9a\u6bb5\u843d\u533a\u95f4\u7684sql\u8bed\u53e5\u9010\u4e2a\u91cd\u65b0\u6267\u884c\u4e00\u6b21\u800c\u5df2\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2467\">\u8be6\u89e3\u4f7f\u7528MySQL\u7684binlog\uff08\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff09\u6062\u590d\u6570\u636e\u7684\u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u8fde\u7eed3\u7bc7\u8bb2\u89e3binlog\u3002\u6062\u590d\u662fbinlog\u7684\u4e24\u5927\u4e3b\u8981\u4f5c\u7528\u4e4b\u4e00\uff0c\u63a5\u4e0b\u6765\u901a\u8fc7\u5b9e\u4f8b\u6f14\u793a\u5982\u4f55\u5229\u7528binlog\u6062\u590d\u6570\u636e [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[83,392,467,429,681,502],"class_list":["post-2467","post","type-post","status-publish","format-standard","hentry","category-sql","tag-mysql","tag-oracle","tag-postgresql","tag-681","tag-502"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2467"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2467\/revisions"}],"predecessor-version":[{"id":2468,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2467\/revisions\/2468"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}