{"id":6180,"date":"2024-11-14T12:45:03","date_gmt":"2024-11-14T04:45:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6180\/"},"modified":"2024-11-14T12:45:03","modified_gmt":"2024-11-14T04:45:03","slug":"mysql%e5%a6%82%e4%bd%95%e5%a4%87%e4%bb%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6180\/","title":{"rendered":"mysql\u5982\u4f55\u5907\u4efd"},"content":{"rendered":"<blockquote><p>\n  mysql\u5907\u4efd\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\uff1amysqldump\u5b9e\u7528\u7a0b\u5e8f\uff1a\u521b\u5efa\u6570\u636e\u5e93\u6587\u672c\u8f6c\u50a8\u3002mysql workbench\uff1a\u56fe\u5f62\u5316\u5de5\u5177\uff0c\u63d0\u4f9b\u589e\u91cf\u5907\u4efd\u3002xtrabackup\uff1a\u9488\u5bf9mysql\u5907\u4efd\u4f18\u5316\uff0c\u521b\u5efa\u4e8c\u8fdb\u5236\u8f6c\u50a8\u3002galera cluster\uff1a\u63d0\u4f9b\u81ea\u52a8\u5907\u4efd\u548c\u6545\u969c\u8f6c\u79fb\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/14\/2024061404482882897.jpg\" class=\"aligncenter\" title=\"mysql\u5982\u4f55\u5907\u4efd\u63d2\u56fe\" alt=\"mysql\u5982\u4f55\u5907\u4efd\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u5907\u4efd\u65b9\u6cd5<\/strong><\/p>\n<p>\u4e3a\u4e86\u4fdd\u62a4\u6570\u636e\u5e93\u4e2d\u7684\u5173\u952e\u6570\u636e\u514d\u53d7\u6216\u635f\u574f\uff0c\u5907\u4efd\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002MySQL \u63d0\u4f9b\u4e86\u591a\u79cd\u5907\u4efd\u65b9\u6cd5\uff0c\u5305\u62ec\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528 dump \u5b9e\u7528\u7a0b\u5e8f<\/strong><\/p>\n<p>mysqldump \u662f MySQL \u968f\u9644\u7684\u4e00\u4e2a\u5b9e\u7528\u7a0b\u5e8f\uff0c\u7528\u4e8e\u521b\u5efa\u6570\u636e\u5e93\u7684\u6587\u672c\u8f6c\u50a8\u3002<\/p>\n<p><strong>\u547d\u4ee4\uff1a<\/strong><\/p>\n<pre>mysqldump -u \u7528\u6237\u540d -p \u5bc6\u7801 \u6570\u636e\u5e93\u540d &gt; \u5907\u4efd\u6587\u4ef6.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u6587\u672c\u6587\u4ef6\uff0c\u4fbf\u4e8e\u67e5\u770b\u548c\u7f16\u8f91\u3002<\/li>\n<li>\u53ef\u4ee5\u9009\u62e9\u4ec5\u5907\u4efd\u7279\u5b9a\u8868\u6216\u6570\u636e\u5e93\u3002<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u5907\u4efd\u53ef\u80fd\u5f88\u5927\uff0c\u5c24\u5176\u662f\u5728\u6570\u636e\u5e93\u8f83\u5927\u65f6\u3002<\/li>\n<li>\u9700\u8981\u91cd\u65b0\u5bfc\u5165\u5907\u4efd\u624d\u80fd\u6062\u590d\u6570\u636e\u3002<\/li>\n<\/ul>\n<p><strong>2. \u4f7f\u7528 MySQL Workbench<\/strong><\/p>\n<p>MySQL Workbench \u662f\u4e00\u6b3e\u56fe\u5f62\u5316\u5de5\u5177\uff0c\u53ef\u7528\u4e8e\u7ba1\u7406\u548c\u5907\u4efd MySQL \u6570\u636e\u5e93\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ul>\n<li>\u8fde\u63a5\u5230\u60a8\u7684\u6570\u636e\u5e93\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9009\u62e9\u201c\u5907\u4efd\u201d\u3002<\/li>\n<li>\u9009\u62e9\u5907\u4efd\u7c7b\u578b\uff08\u4f8b\u5982\uff0c\u5b8c\u6574\u5907\u4efd\u6216\u589e\u91cf\u5907\u4efd\uff09\u3002<\/li>\n<li>\u6307\u5b9a\u5907\u4efd\u6587\u4ef6\u7684\u76ee\u6807\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u56fe\u5f62\u5316\u754c\u9762\uff0c\u6613\u4e8e\u4f7f\u7528\u3002<\/li>\n<li>\u53ef\u4ee5\u9009\u62e9\u57fa\u4e8e\u65f6\u95f4\u6216\u4e8b\u52a1\u7684\u589e\u91cf\u5907\u4efd\u3002<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u9700\u8981\u5b89\u88c5 MySQL Workbench\u3002<\/li>\n<li>\u53ef\u80fd\u4e0d\u9002\u7528\u4e8e\u6240\u6709\u64cd\u4f5c\u7cfb\u7edf\u3002<\/li>\n<\/ul>\n<p><strong>3. \u4f7f\u7528 XtraBackup<\/strong><\/p>\n<p>XtraBackup \u662f\u4e00\u4e2a\u5f00\u6e90\u5de5\u5177\uff0c\u4e13\u4e3a MySQL \u5907\u4efd\u800c\u8bbe\u8ba1\u3002<\/p>\n<p><strong>\u547d\u4ee4\uff1a<\/strong><\/p>\n<pre>xtrabackup --backup --target-dir=\/path\/to\/backup<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u9488\u5bf9 MySQL \u5907\u4efd\u8fdb\u884c\u4e86\u4f18\u5316\u3002<\/li>\n<li>\u521b\u5efa\u4e8c\u8fdb\u5236\u8f6c\u50a8\uff0c\u6bd4\u6587\u672c\u8f6c\u50a8\u66f4\u5c0f\u66f4\u5feb\u3002<\/li>\n<li>\u652f\u6301\u70ed\u5907\u4efd\uff0c\u4e0d\u4f1a\u4e2d\u65ad\u6570\u636e\u5e93\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u9700\u8981\u5b89\u88c5 XtraBackup\u3002<\/li>\n<li>\u6062\u590d\u4e8c\u8fdb\u5236\u8f6c\u50a8\u9700\u8981\u4f7f\u7528 Percona XtraDB Cluster\u3002<\/li>\n<\/ul>\n<p><strong>4. \u4f7f\u7528 Galera Cluster<\/strong><\/p>\n<p>Galera Cluster \u662f\u4e00\u4e2a MySQL \u5206\u53d1\uff0c\u63d0\u4f9b\u4e86\u96c6\u6210\u7684\u590d\u5236\u548c\u81ea\u52a8\u6545\u969c\u8f6c\u79fb\u529f\u80fd\u3002<\/p>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u81ea\u52a8\u5907\u4efd\u5230\u4e3b\u8282\u70b9\u548c\u4ece\u8282\u70b9\u3002<\/li>\n<li>\u5982\u679c\u4e3b\u8282\u70b9\u53d1\u751f\u6545\u969c\uff0c\u53ef\u4ee5\u4ece\u4ece\u8282\u70b9\u6062\u590d\u6570\u636e\u3002<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u9700\u8981\u5b89\u88c5\u548c\u914d\u7f6e Galera \u96c6\u7fa4\u3002<\/li>\n<li>\u53ef\u80fd\u4e0d\u9002\u7528\u4e8e\u6240\u6709\u7528\u4f8b\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5907\u4efd\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql\u5907\u4efd\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\uff1amysqldump\u5b9e\u7528\u7a0b\u5e8f\uff1a\u521b\u5efa\u6570\u636e\u5e93\u6587\u672c\u8f6c\u50a8\u3002mysql workbench\uff1a\u56fe\u5f62\u5316\u5de5\u5177\uff0c\u63d0\u4f9b\u589e\u91cf\u5907\u4efd\u3002xtrabackup\uff1a\u9488\u5bf9mysql\u5907\u4efd\u4f18\u5316\uff0c\u521b\u5efa\u4e8c\u8fdb\u5236\u8f6c\u50a8\u3002galera cluster\uff1a\u63d0\u4f9b\u81ea\u52a8\u5907\u4efd\u548c\u6545\u969c\u8f6c\u79fb\u3002 MySQL \u5907\u4efd\u65b9\u6cd5 \u4e3a\u4e86\u4fdd\u62a4\u6570\u636e\u5e93\u4e2d\u7684\u5173\u952e\u6570\u636e\u514d\u53d7\u6216\u635f\u574f\uff0c\u5907\u4efd\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002MySQL \u63d0\u4f9b\u4e86\u591a\u79cd\u5907\u4efd\u65b9\u6cd5\uff0c\u5305\u62ec\uff1a 1. \u4f7f\u7528 dump \u5b9e\u7528\u7a0b\u5e8f mysqldump \u662f MySQL \u968f\u9644\u7684\u4e00\u4e2a\u5b9e\u7528\u7a0b\u5e8f\uff0c\u7528\u4e8e\u521b\u5efa\u6570\u636e\u5e93\u7684\u6587\u672c\u8f6c\u50a8\u3002 \u547d\u4ee4\uff1a mysqldump -u \u7528\u6237\u540d -p \u5bc6\u7801 \u6570\u636e\u5e93\u540d &gt; \u5907\u4efd\u6587\u4ef6.sql \u767b\u5f55\u540e\u590d\u5236 \u4f18\u70b9\uff1a \u521b\u5efa\u6587\u672c\u6587\u4ef6\uff0c\u4fbf\u4e8e\u67e5\u770b\u548c\u7f16\u8f91\u3002 \u53ef\u4ee5\u9009\u62e9\u4ec5\u5907\u4efd\u7279\u5b9a\u8868\u6216\u6570\u636e\u5e93\u3002 \u7f3a\u70b9\uff1a \u5907\u4efd\u53ef\u80fd\u5f88\u5927\uff0c\u5c24\u5176\u662f\u5728\u6570\u636e\u5e93\u8f83\u5927\u65f6\u3002 \u9700\u8981\u91cd\u65b0\u5bfc\u5165\u5907\u4efd\u624d\u80fd\u6062\u590d\u6570\u636e\u3002 2. \u4f7f\u7528 MySQL Workbench MySQL Workbench \u662f\u4e00\u6b3e\u56fe\u5f62\u5316\u5de5\u5177\uff0c\u53ef\u7528\u4e8e\u7ba1\u7406\u548c\u5907\u4efd MySQL \u6570\u636e\u5e93\u3002 \u6b65\u9aa4\uff1a \u8fde\u63a5\u5230\u60a8\u7684\u6570\u636e\u5e93\u3002 \u53f3\u952e\u5355\u51fb\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9009\u62e9\u201c\u5907\u4efd\u201d\u3002 \u9009\u62e9\u5907\u4efd\u7c7b\u578b\uff08\u4f8b\u5982\uff0c\u5b8c\u6574\u5907\u4efd\u6216\u589e\u91cf\u5907\u4efd\uff09\u3002 \u6307\u5b9a\u5907\u4efd\u6587\u4ef6\u7684\u76ee\u6807\u4f4d\u7f6e\u3002 \u4f18\u70b9\uff1a \u56fe\u5f62\u5316\u754c\u9762\uff0c\u6613\u4e8e\u4f7f\u7528\u3002 \u53ef\u4ee5\u9009\u62e9\u57fa\u4e8e\u65f6\u95f4\u6216\u4e8b\u52a1\u7684\u589e\u91cf\u5907\u4efd\u3002 \u7f3a\u70b9\uff1a \u9700\u8981\u5b89\u88c5 MySQL Workbench\u3002 \u53ef\u80fd\u4e0d\u9002\u7528\u4e8e\u6240\u6709\u64cd\u4f5c\u7cfb\u7edf\u3002 3. \u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6180","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6180"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6180\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}