{"id":6185,"date":"2024-11-14T10:07:27","date_gmt":"2024-11-14T02:07:27","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6185\/"},"modified":"2024-11-14T10:07:27","modified_gmt":"2024-11-14T02:07:27","slug":"mysql%e5%a6%82%e4%bd%95%e5%a4%87%e4%bb%bd%e6%95%b4%e4%b8%aa%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6185\/","title":{"rendered":"mysql\u5982\u4f55\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u5728 mysql \u4e2d\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u7684\u6b65\u9aa4\uff1a\u4f7f\u7528 mysqldump \u5de5\u5177\uff1amysqldump -u \u7528\u6237\u540d -p \u6570\u636e\u5e93\u540d &gt; \u5907\u4efd\u6587\u4ef6.sql\u6267\u884c\u5907\u4efd\u5b89\u5168\u5730\u5b58\u50a8\u5907\u4efd\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/14\/2024061405212438747.jpg\" class=\"aligncenter\" title=\"mysql\u5982\u4f55\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"mysql\u5982\u4f55\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 MySQL \u4e2d\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93<\/strong><\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u5de5\u5177<\/strong><\/p>\n<p>mysqldump \u662f\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u548c\u6062\u590d MySQL \u6570\u636e\u5e93\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u8981\u4f7f\u7528\u5b83\uff0c\u8bf7\u6253\u5f00\u547d\u4ee4\u884c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysqldump -u \u7528\u6237\u540d -p \u6570\u636e\u5e93\u540d &gt; \u5907\u4efd\u6587\u4ef6.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li> <strong>\u7528\u6237\u540d\uff1a<\/strong>\u4f60\u7684 MySQL \u7528\u6237\u540d<\/li>\n<li> <strong>\u5bc6\u7801\uff1a<\/strong>\u4f60\u7684 MySQL \u5bc6\u7801\uff08\u5982\u679c\u8bbe\u7f6e\u4e86\uff09<\/li>\n<li> <strong>\u6570\u636e\u5e93\u540d\uff1a<\/strong>\u4f60\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0<\/li>\n<li> <strong>\u5907\u4efd\u6587\u4ef6.sql\uff1a<\/strong>\u5907\u4efd\u6587\u4ef6\u7684\u540d\u79f0\u548c\u8def\u5f84<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 2\uff1a\u6267\u884c\u5907\u4efd<\/strong><\/p>\n<p>\u8f93\u5165\u4e0a\u8ff0\u547d\u4ee4\u540e\uff0c\u6309\u56de\u8f66\u952e\u5f00\u59cb\u5907\u4efd\u3002mysqldump \u5c06\u521b\u5efa\u5305\u542b\u6570\u636e\u5e93\u67b6\u6784\u548c\u6570\u636e\u7684 SQL \u8f6c\u50a8\u6587\u4ef6\u3002\u5907\u4efd\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u6570\u636e\u5e93\u7684\u5927\u5c0f\u3002<\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u5b89\u5168\u5730\u5b58\u50a8\u5907\u4efd<\/strong><\/p>\n<p>\u5907\u4efd\u5b8c\u6210\u540e\uff0c\u5c06\u5907\u4efd\u6587\u4ef6\u5b58\u50a8\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\uff0c\u4f8b\u5982\u4e91\u5b58\u50a8\u6216\u5916\u90e8\u786c\u76d8\u9a71\u52a8\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4f60\u7684\u6570\u636e\u5728\u6216\u635f\u574f\u7684\u60c5\u51b5\u4e0b\u5f97\u5230\u4fdd\u62a4\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u8981\u5907\u4efd\u540d\u4e3a &#8220;mydb&#8221; \u7684\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysqldump -u root -p mydb &gt; \/home\/backups\/mydb.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a &#8220;mydb.sql&#8221; \u7684\u5907\u4efd\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728 &#8220;\/home\/backups&#8221; \u76ee\u5f55\u4e2d\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5907\u4efd\u6574\u4e2a\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>\u5728 mysql \u4e2d\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u7684\u6b65\u9aa4\uff1a\u4f7f\u7528 mysqldump \u5de5\u5177\uff1amysqldump -u \u7528\u6237\u540d -p \u6570\u636e\u5e93\u540d &gt; \u5907\u4efd\u6587\u4ef6.sql\u6267\u884c\u5907\u4efd\u5b89\u5168\u5730\u5b58\u50a8\u5907\u4efd \u5982\u4f55\u5728 MySQL \u4e2d\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93 \u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u5de5\u5177 mysqldump \u662f\u4e00\u4e2a\u7528\u4e8e\u5907\u4efd\u548c\u6062\u590d MySQL \u6570\u636e\u5e93\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u8981\u4f7f\u7528\u5b83\uff0c\u8bf7\u6253\u5f00\u547d\u4ee4\u884c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a mysqldump -u \u7528\u6237\u540d -p \u6570\u636e\u5e93\u540d &gt; \u5907\u4efd\u6587\u4ef6.sql \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff1a \u7528\u6237\u540d\uff1a\u4f60\u7684 MySQL \u7528\u6237\u540d \u5bc6\u7801\uff1a\u4f60\u7684 MySQL \u5bc6\u7801\uff08\u5982\u679c\u8bbe\u7f6e\u4e86\uff09 \u6570\u636e\u5e93\u540d\uff1a\u4f60\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0 \u5907\u4efd\u6587\u4ef6.sql\uff1a\u5907\u4efd\u6587\u4ef6\u7684\u540d\u79f0\u548c\u8def\u5f84 \u6b65\u9aa4 2\uff1a\u6267\u884c\u5907\u4efd \u8f93\u5165\u4e0a\u8ff0\u547d\u4ee4\u540e\uff0c\u6309\u56de\u8f66\u952e\u5f00\u59cb\u5907\u4efd\u3002mysqldump \u5c06\u521b\u5efa\u5305\u542b\u6570\u636e\u5e93\u67b6\u6784\u548c\u6570\u636e\u7684 SQL \u8f6c\u50a8\u6587\u4ef6\u3002\u5907\u4efd\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u6570\u636e\u5e93\u7684\u5927\u5c0f\u3002 \u6b65\u9aa4 3\uff1a\u5b89\u5168\u5730\u5b58\u50a8\u5907\u4efd \u5907\u4efd\u5b8c\u6210\u540e\uff0c\u5c06\u5907\u4efd\u6587\u4ef6\u5b58\u50a8\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\uff0c\u4f8b\u5982\u4e91\u5b58\u50a8\u6216\u5916\u90e8\u786c\u76d8\u9a71\u52a8\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4f60\u7684\u6570\u636e\u5728\u6216\u635f\u574f\u7684\u60c5\u51b5\u4e0b\u5f97\u5230\u4fdd\u62a4\u3002 \u793a\u4f8b\uff1a \u8981\u5907\u4efd\u540d\u4e3a &#8220;mydb&#8221; \u7684\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a mysqldump -u root [&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-6185","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6185","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=6185"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6185\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}