{"id":5391,"date":"2024-11-14T11:32:38","date_gmt":"2024-11-14T03:32:38","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5391\/"},"modified":"2024-11-14T11:32:38","modified_gmt":"2024-11-14T03:32:38","slug":"mysql%e6%80%8e%e4%b9%88%e4%bf%9d%e5%ad%98%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5391\/","title":{"rendered":"mysql\u600e\u4e48\u4fdd\u5b58\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u8981\u4fdd\u5b58 mysql \u6570\u636e\u5e93\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u4f7f\u7528 mysqldump \u521b\u5efa\u5907\u4efd\uff1a\u6307\u5b9a\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u79f0\u548c\u5907\u4efd\u6587\u4ef6\u540d\u3002\u5c06\u5907\u4efd\u6587\u4ef6\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\u3002\u901a\u8fc7 mysql workbench \u6216\u547d\u4ee4\u884c\uff08\u6307\u5b9a\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u79f0\u548c\u5907\u4efd\u6587\u4ef6\uff09\u6062\u590d\u6570\u636e\u5e93\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/28\/2024052810212663323.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u4fdd\u5b58\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u4fdd\u5b58\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4fdd\u5b58 MySQL \u6570\u636e\u5e93<\/strong><\/p>\n<p>\u4e3a\u4e86\u4fdd\u62a4\u5b58\u50a8\u5728 MySQL \u6570\u636e\u5e93\u4e2d\u7684\u91cd\u8981\u6570\u636e\uff0c\u4fdd\u5b58\u6570\u636e\u5e93\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u4ee5\u4e0b\u6b65\u9aa4\u6307\u5bfc\u60a8\u5982\u4f55\u6267\u884c\u6b64\u64cd\u4f5c\uff1a<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u521b\u5efa\u5907\u4efd<\/strong><\/p>\n<pre>mysqldump -u root -p --add-drop-database --databases [\u6570\u636e\u5e93\u540d\u79f0] &gt; [\u5907\u4efd\u6587\u4ef6\u540d].sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u7406\u89e3 mysqldump \u9009\u9879<\/strong><\/p>\n<ul>\n<li>-u root -p\uff1a\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\u4ee5\u8fde\u63a5\u5230 MySQL\u3002<\/li>\n<li>&#8211;add-drop-database\uff1a\u5728\u5907\u4efd\u4e2d\u6dfb\u52a0 DROP DATABASE \u8bed\u53e5\uff0c\u4ee5\u4fbf\u5728\u6062\u590d\u65f6\u5220\u9664\u73b0\u6709\u6570\u636e\u5e93\u3002<\/li>\n<li>&#8211;databases [\u6570\u636e\u5e93\u540d\u79f0]\uff1a\u6307\u5b9a\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002<\/li>\n<li>&gt;[\u5907\u4efd\u6587\u4ef6\u540d].sql\uff1a\u6307\u5b9a\u5907\u4efd\u6587\u4ef6\u7684\u540d\u79f0\u548c\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 3\uff1a\u672c\u5730\u4fdd\u5b58\u5907\u4efd\u6587\u4ef6<\/strong><\/p>\n<p>\u5c06\u5907\u4efd\u6587\u4ef6\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\uff0c\u4f8b\u5982\u672c\u5730\u8ba1\u7b97\u673a\u3001\u5916\u90e8\u786c\u76d8\u9a71\u52a8\u5668\u6216\u4e91\u5b58\u50a8\u3002<\/p>\n<p><strong>\u6b65\u9aa4 4\uff1a\u901a\u8fc7 MySQL Workbench \u6062\u590d\u6570\u636e\u5e93<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 MySQL Workbench\u3002<\/li>\n<li>\u5355\u51fb\u201c\u670d\u52a1\u5668\u201d\u9009\u9879\u5361\u5e76\u8fde\u63a5\u5230 MySQL\u3002<\/li>\n<li>\u5355\u51fb\u201c\u6570\u636e\u5e93\u201d\u9009\u9879\u5361\uff0c\u53f3\u952e\u5355\u51fb\u6570\u636e\u5e93\u5217\u8868\u5e76\u9009\u62e9\u201c\u8fd8\u539f\u201d\u3002<\/li>\n<li>\u9009\u62e9\u6b65\u9aa4 2 \u4e2d\u521b\u5efa\u7684\u5907\u4efd\u6587\u4ef6\u3002<\/li>\n<li>\u5355\u51fb\u201c\u6267\u884c\u201d\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 5\uff1a\u901a\u8fc7\u547d\u4ee4\u884c\u6062\u590d\u6570\u636e\u5e93<\/strong><\/p>\n<pre>mysql -u root -p [\u6570\u636e\u5e93\u540d\u79f0] &lt; [\u5907\u4efd\u6587\u4ef6\u540d].sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 6\uff1a\u7406\u89e3\u6062\u590d\u547d\u4ee4<\/strong><\/p>\n<ul>\n<li>-u root -p\uff1a\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\u4ee5\u8fde\u63a5\u5230 MySQL\u3002<\/li>\n<li>[\u6570\u636e\u5e93\u540d\u79f0]\uff1a\u6307\u5b9a\u8981\u6062\u590d\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002<\/li>\n<li> <\/li>\n<\/ul>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5b9a\u671f\u5907\u4efd\u6570\u636e\u5e93\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u5b89\u5168\u3002<\/li>\n<li>\u5c06\u5907\u4efd\u5b58\u50a8\u5728\u591a\u4e2a\u4f4d\u7f6e\u4ee5\u63d0\u9ad8\u5197\u4f59\u6027\u3002<\/li>\n<li>\u4f7f\u7528\u52a0\u5bc6\u4fdd\u62a4\u5907\u4efd\u6587\u4ef6\u514d\u906d\u672a\u7ecf\u6388\u6743\u7684\u8bbf\u95ee\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u4fdd\u5b58\u6570\u636e\u5e93\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>\u8981\u4fdd\u5b58 mysql \u6570\u636e\u5e93\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u4f7f\u7528 mysqldump \u521b\u5efa\u5907\u4efd\uff1a\u6307\u5b9a\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u79f0\u548c\u5907\u4efd\u6587\u4ef6\u540d\u3002\u5c06\u5907\u4efd\u6587\u4ef6\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\u3002\u901a\u8fc7 mysql workbench \u6216\u547d\u4ee4\u884c\uff08\u6307\u5b9a\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u79f0\u548c\u5907\u4efd\u6587\u4ef6\uff09\u6062\u590d\u6570\u636e\u5e93\u3002 \u5982\u4f55\u4fdd\u5b58 MySQL \u6570\u636e\u5e93 \u4e3a\u4e86\u4fdd\u62a4\u5b58\u50a8\u5728 MySQL \u6570\u636e\u5e93\u4e2d\u7684\u91cd\u8981\u6570\u636e\uff0c\u4fdd\u5b58\u6570\u636e\u5e93\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u4ee5\u4e0b\u6b65\u9aa4\u6307\u5bfc\u60a8\u5982\u4f55\u6267\u884c\u6b64\u64cd\u4f5c\uff1a \u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u521b\u5efa\u5907\u4efd mysqldump -u root -p &#8211;add-drop-database &#8211;databases [\u6570\u636e\u5e93\u540d\u79f0] &gt; [\u5907\u4efd\u6587\u4ef6\u540d].sql \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 2\uff1a\u7406\u89e3 mysqldump \u9009\u9879 -u root -p\uff1a\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\u4ee5\u8fde\u63a5\u5230 MySQL\u3002 &#8211;add-drop-database\uff1a\u5728\u5907\u4efd\u4e2d\u6dfb\u52a0 DROP DATABASE \u8bed\u53e5\uff0c\u4ee5\u4fbf\u5728\u6062\u590d\u65f6\u5220\u9664\u73b0\u6709\u6570\u636e\u5e93\u3002 &#8211;databases [\u6570\u636e\u5e93\u540d\u79f0]\uff1a\u6307\u5b9a\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002 &gt;[\u5907\u4efd\u6587\u4ef6\u540d].sql\uff1a\u6307\u5b9a\u5907\u4efd\u6587\u4ef6\u7684\u540d\u79f0\u548c\u4f4d\u7f6e\u3002 \u6b65\u9aa4 3\uff1a\u672c\u5730\u4fdd\u5b58\u5907\u4efd\u6587\u4ef6 \u5c06\u5907\u4efd\u6587\u4ef6\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\uff0c\u4f8b\u5982\u672c\u5730\u8ba1\u7b97\u673a\u3001\u5916\u90e8\u786c\u76d8\u9a71\u52a8\u5668\u6216\u4e91\u5b58\u50a8\u3002 \u6b65\u9aa4 4\uff1a\u901a\u8fc7 MySQL Workbench \u6062\u590d\u6570\u636e\u5e93 \u6253\u5f00 MySQL Workbench\u3002 \u5355\u51fb\u201c\u670d\u52a1\u5668\u201d\u9009\u9879\u5361\u5e76\u8fde\u63a5\u5230 [&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-5391","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5391","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=5391"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5391\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}