{"id":6549,"date":"2024-11-14T11:28:44","date_gmt":"2024-11-14T03:28:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6549\/"},"modified":"2024-11-14T11:28:44","modified_gmt":"2024-11-14T03:28:44","slug":"mysql%e6%80%8e%e4%b9%88%e5%af%bc%e5%87%ba%e6%95%b0%e6%8d%ae%e5%ba%93%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6549\/","title":{"rendered":"mysql\u600e\u4e48\u5bfc\u51fa\u6570\u636e\u5e93\u4ee3\u7801"},"content":{"rendered":"<blockquote><p>\n  \u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 mysqldump \u547d\u4ee4\u884c\u5de5\u5177\u6216 mysql workbench \u56fe\u5f62\u754c\u9762\u5de5\u5177\u6765\u5bfc\u51fa mysql \u6570\u636e\u5e93\u4ee3\u7801\u3002mysqldump \u547d\u4ee4\u652f\u6301\u4ee5\u4e0b\u9009\u9879\uff1a-u [\u7528\u6237\u540d]\u3001-p\u3001&#8211;databases [\u6570\u636e\u5e93\u540d\u79f0]\u3001&#8211;all-databases\u3001&#8211;tables [\u8868\u540d\u79f0]\u3001&#8211;single-transaction\u3001&#8211;routines\u3001&#8211;triggers\u3001&#8211;data \u548c &#8211;structure-only\u3002mysql workbench \u5141\u8bb8\u901a\u8fc7\u53f3\u952e\u5355\u51fb\u6570\u636e\u5e93\u5e76\u9009\u62e9\u201c\u6570\u636e\u5e93\u5de5\u5177\u201d\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080520131028352.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u5bfc\u51fa\u6570\u636e\u5e93\u4ee3\u7801\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u5bfc\u51fa\u6570\u636e\u5e93\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u4ee3\u7801<\/strong><\/p>\n<p><strong>\u5bfc\u51fa\u65b9\u5f0f\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u4f7f\u7528 dump \u547d\u4ee4\u884c\u5de5\u5177<\/strong><\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u7a97\u53e3\u3002<\/li>\n<li>\u5bfc\u822a\u5230 MySQL \u5b89\u88c5\u76ee\u5f55\u7684 bin \u6587\u4ef6\u5939\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5176\u4e2d\uff1a<\/li>\n<\/ol>\n<pre>mysqldump [\u9009\u9879] &lt;\u6570\u636e\u5e93\u540d\u79f0&gt; &gt; &lt;\u8f93\u51fa\u6587\u4ef6\u540d&gt;.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>mysqldump -u root -p --databases test_db &gt; test_db.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li><strong>\u4f7f\u7528 MySQL Workbench \u56fe\u5f62\u754c\u9762\u5de5\u5177<\/strong><\/li>\n<\/ul>\n<ol>\n<li>\u5728 MySQL Workbench \u4e2d\u6253\u5f00\u6570\u636e\u5e93\u8fde\u63a5\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u8981\u5bfc\u51fa\u7684\u6570\u636e\u5e93\u3002<\/li>\n<li>\u9009\u62e9\u201c\u6570\u636e\u5e93\u5de5\u5177\u201d&gt;\u201c\u5bfc\u51fa\u201d\u3002<\/li>\n<li>\u5728\u201c\u5bfc\u51fa\u5230\u6587\u4ef6\u201d\u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u4f8b\u5982\uff0cSQL\uff09\u3002<\/li>\n<li>\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u548c\u8def\u5f84\uff0c\u7136\u540e\u5355\u51fb\u201c\u5f00\u59cb\u201d\u3002<\/li>\n<\/ol>\n<p><strong>\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li> <strong>-u [\u7528\u6237\u540d]<\/strong>\uff1a\u6307\u5b9a\u7528\u4e8e\u8fde\u63a5\u6570\u636e\u5e93\u7684 MySQL \u7528\u6237\u540d\u3002<\/li>\n<li> <strong>-p<\/strong>\uff1a\u63d0\u793a\u8f93\u5165 MySQL \u7528\u6237\u5bc6\u7801\u3002<\/li>\n<li> <strong>&#8211;databases [\u6570\u636e\u5e93\u540d\u79f0]<\/strong>\uff1a\u5bfc\u51fa\u6307\u5b9a\u7684\u6570\u636e\u5e93\u3002<\/li>\n<li> <strong>&#8211;all-databases<\/strong>\uff1a\u5bfc\u51fa\u6240\u6709\u6570\u636e\u5e93\u3002<\/li>\n<li> <strong>&#8211;tables [\u8868\u540d\u79f0]<\/strong>\uff1a\u4ec5\u5bfc\u51fa\u6307\u5b9a\u7684\u8868\u3002<\/li>\n<li> <strong>&#8211;single-transaction<\/strong>\uff1a\u5c06\u6570\u636e\u5e93\u5bfc\u51fa\u4e3a\u5355\u4e2a\u4e8b\u52a1\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n<li> <strong>&#8211;routines<\/strong>\uff1a\u5bfc\u51fa\u5b58\u50a8\u8fc7\u7a0b\u3001\u51fd\u6570\u548c\u89e6\u53d1\u5668\u3002<\/li>\n<li> <strong>&#8211;triggers<\/strong>\uff1a\u5bfc\u51fa\u89e6\u53d1\u5668\u3002<\/li>\n<li> <strong>&#8211;data<\/strong>\uff1a\u5bfc\u51fa\u8868\u6570\u636e\u3002<\/li>\n<li> <strong>&#8211;structure-only<\/strong>\uff1a\u4ec5\u5bfc\u51fa\u8868\u7ed3\u6784\u800c\u4e0d\u5bfc\u51fa\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5bfc\u51fa\u6570\u636e\u5e93\u4ee3\u7801\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>\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 mysqldump \u547d\u4ee4\u884c\u5de5\u5177\u6216 mysql workbench \u56fe\u5f62\u754c\u9762\u5de5\u5177\u6765\u5bfc\u51fa mysql \u6570\u636e\u5e93\u4ee3\u7801\u3002mysqldump \u547d\u4ee4\u652f\u6301\u4ee5\u4e0b\u9009\u9879\uff1a-u [\u7528\u6237\u540d]\u3001-p\u3001&#8211;databases [\u6570\u636e\u5e93\u540d\u79f0]\u3001&#8211;all-databases\u3001&#8211;tables [\u8868\u540d\u79f0]\u3001&#8211;single-transaction\u3001&#8211;routines\u3001&#8211;triggers\u3001&#8211;data \u548c &#8211;structure-only\u3002mysql workbench \u5141\u8bb8\u901a\u8fc7\u53f3\u952e\u5355\u51fb\u6570\u636e\u5e93\u5e76\u9009\u62e9\u201c\u6570\u636e\u5e93\u5de5\u5177\u201d \u5982\u4f55\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u4ee3\u7801 \u5bfc\u51fa\u65b9\u5f0f\uff1a \u4f7f\u7528 dump \u547d\u4ee4\u884c\u5de5\u5177 \u6b65\u9aa4\uff1a \u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u7a97\u53e3\u3002 \u5bfc\u822a\u5230 MySQL \u5b89\u88c5\u76ee\u5f55\u7684 bin \u6587\u4ef6\u5939\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5176\u4e2d\uff1a mysqldump [\u9009\u9879] &lt;\u6570\u636e\u5e93\u540d\u79f0&gt; &gt; &lt;\u8f93\u51fa\u6587\u4ef6\u540d&gt;.sql \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\uff1a mysqldump -u root -p &#8211;databases test_db &gt; test_db.sql \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528 MySQL Workbench \u56fe\u5f62\u754c\u9762\u5de5\u5177 \u5728 MySQL Workbench \u4e2d\u6253\u5f00\u6570\u636e\u5e93\u8fde\u63a5\u3002 [&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-6549","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6549","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=6549"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6549\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}