{"id":6576,"date":"2024-11-14T12:04:01","date_gmt":"2024-11-14T04:04:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6576\/"},"modified":"2024-11-14T12:04:01","modified_gmt":"2024-11-14T04:04:01","slug":"mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%80%8e%e4%b9%88%e5%af%bc%e5%87%ba%e8%a1%a8%e6%a0%bc","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6576\/","title":{"rendered":"mysql\u6570\u636e\u5e93\u600e\u4e48\u5bfc\u51fa\u8868\u683c"},"content":{"rendered":"<blockquote><p>\n  \u901a\u8fc7 mysqldump \u547d\u4ee4\u53ef\u5bfc\u51fa mysql \u8868\u683c\uff0c\u65b9\u6cd5\u5982\u4e0b\uff1a\u4f7f\u7528 mysqldump \u547d\u4ee4\u6307\u5b9a\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u548c\u8868\u683c\u540d\u3002\u53ef\u9009\uff1a\u6307\u5b9a\u5bfc\u51fa\u9009\u9879\uff0c\u5982\u4ec5\u5bfc\u51fa\u7ed3\u6784\u6216\u8df3\u8fc7 drop table \u8bed\u53e5\u3002\u8f93\u5165 mysql \u51ed\u636e\u3002\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\u4fdd\u5b58\u5bfc\u51fa\u7684 sql \u6587\u4ef6\u3002\u9a8c\u8bc1\u5bfc\u51fa\u7ed3\u679c\u4ee5\u786e\u4fdd\u6210\u529f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080520424626168.jpg\" class=\"aligncenter\" title=\"mysql\u6570\u636e\u5e93\u600e\u4e48\u5bfc\u51fa\u8868\u683c\u63d2\u56fe\" alt=\"mysql\u6570\u636e\u5e93\u600e\u4e48\u5bfc\u51fa\u8868\u683c\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5bfc\u51fa MySQL \u8868\u683c<\/strong><\/p>\n<p>\u5bfc\u51fa MySQL \u8868\u683c\u662f\u4e00\u79cd\u83b7\u53d6\u6570\u636e\u5e93\u6570\u636e\u526f\u672c\u5e76\u5c06\u5176\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\u4ee5\u8fdb\u884c\u5907\u4efd\u6216\u5206\u6790\u7684\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u662f\u6709\u5173\u5982\u4f55\u6267\u884c\u6b64\u64cd\u4f5c\u7684\u5206\u6b65\u6307\u5357\uff1a<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u547d\u4ee4<\/strong><\/p>\n<p>mysqldump \u662f MySQL \u7684\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u5bfc\u51fa\u6570\u636e\u5e93\u3002\u8981\u5bfc\u51fa\u5355\u4e2a\u8868\u683c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysqldump -u [\u7528\u6237\u540d] -p [\u5bc6\u7801] [\u6570\u636e\u5e93\u540d] [\u8868\u683c\u540d] &gt; [\u6587\u4ef6\u8def\u5f84]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>mysqldump -u root -p my_database my_table &gt; \/path\/to\/my_table.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u6307\u5b9a\u5bfc\u51fa\u9009\u9879\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u9644\u52a0\u9009\u9879\u6765\u5b9a\u5236\u5bfc\u51fa\u8fc7\u7a0b\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>&#8211;no-data: \u4ec5\u5bfc\u51fa\u8868\u683c\u7ed3\u6784\uff0c\u4e0d\u5bfc\u51fa\u6570\u636e\u3002<\/li>\n<li>&#8211;extended-insert: \u4f7f\u7528\u66f4\u8be6\u7ec6\u7684 INSERT \u8bed\u53e5\u5bfc\u51fa\u6570\u636e\u3002<\/li>\n<li>&#8211;skip-add-drop-table: \u4ece\u5bfc\u51fa\u6587\u4ef6\u4e2d\u7701\u7565 DROP TABLE \u8bed\u53e5\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 3\uff1a\u8f93\u5165\u51ed\u636e<\/strong><\/p>\n<p>\u5728\u6267\u884c\u547d\u4ee4\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u8f93\u5165 MySQL \u51ed\u636e\uff0c\u5305\u62ec\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<p><strong>\u6b65\u9aa4 4\uff1a\u4fdd\u5b58\u5bfc\u51fa\u6587\u4ef6<\/strong><\/p>\n<p>\u547d\u4ee4\u5c06\u751f\u6210\u5305\u542b\u5bfc\u51fa\u8868\u683c\u5185\u5bb9\u7684 SQL \u6587\u4ef6\u3002\u6587\u4ef6\u8def\u5f84\u6307\u5b9a\u8981\u4fdd\u5b58\u8be5\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002<\/p>\n<p><strong>\u6b65\u9aa4 5\uff1a\u9a8c\u8bc1\u5bfc\u51fa<\/strong><\/p>\n<p>\u5bfc\u51fa\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00 SQL \u6587\u4ef6\u5e76\u68c0\u67e5\u5185\u5bb9\u4ee5\u786e\u4fdd\u6210\u529f\u5bfc\u51fa\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6570\u636e\u5e93\u600e\u4e48\u5bfc\u51fa\u8868\u683c\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>\u901a\u8fc7 mysqldump \u547d\u4ee4\u53ef\u5bfc\u51fa mysql \u8868\u683c\uff0c\u65b9\u6cd5\u5982\u4e0b\uff1a\u4f7f\u7528 mysqldump \u547d\u4ee4\u6307\u5b9a\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u548c\u8868\u683c\u540d\u3002\u53ef\u9009\uff1a\u6307\u5b9a\u5bfc\u51fa\u9009\u9879\uff0c\u5982\u4ec5\u5bfc\u51fa\u7ed3\u6784\u6216\u8df3\u8fc7 drop table \u8bed\u53e5\u3002\u8f93\u5165 mysql \u51ed\u636e\u3002\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\u4fdd\u5b58\u5bfc\u51fa\u7684 sql \u6587\u4ef6\u3002\u9a8c\u8bc1\u5bfc\u51fa\u7ed3\u679c\u4ee5\u786e\u4fdd\u6210\u529f\u3002 \u5982\u4f55\u5bfc\u51fa MySQL \u8868\u683c \u5bfc\u51fa MySQL \u8868\u683c\u662f\u4e00\u79cd\u83b7\u53d6\u6570\u636e\u5e93\u6570\u636e\u526f\u672c\u5e76\u5c06\u5176\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\u4ee5\u8fdb\u884c\u5907\u4efd\u6216\u5206\u6790\u7684\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u662f\u6709\u5173\u5982\u4f55\u6267\u884c\u6b64\u64cd\u4f5c\u7684\u5206\u6b65\u6307\u5357\uff1a \u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u547d\u4ee4 mysqldump \u662f MySQL \u7684\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u5bfc\u51fa\u6570\u636e\u5e93\u3002\u8981\u5bfc\u51fa\u5355\u4e2a\u8868\u683c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a mysqldump -u [\u7528\u6237\u540d] -p [\u5bc6\u7801] [\u6570\u636e\u5e93\u540d] [\u8868\u683c\u540d] &gt; [\u6587\u4ef6\u8def\u5f84] \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff1a mysqldump -u root -p my_database my_table &gt; \/path\/to\/my_table.sql \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 2\uff1a\u6307\u5b9a\u5bfc\u51fa\u9009\u9879\uff08\u53ef\u9009\uff09 \u60a8\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u9644\u52a0\u9009\u9879\u6765\u5b9a\u5236\u5bfc\u51fa\u8fc7\u7a0b\uff0c\u4f8b\u5982\uff1a &#8211;no-data: \u4ec5\u5bfc\u51fa\u8868\u683c\u7ed3\u6784\uff0c\u4e0d\u5bfc\u51fa\u6570\u636e\u3002 &#8211;extended-insert: \u4f7f\u7528\u66f4\u8be6\u7ec6\u7684 [&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-6576","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6576","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=6576"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6576\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}