{"id":6582,"date":"2024-11-14T11:48:59","date_gmt":"2024-11-14T03:48:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6582\/"},"modified":"2024-11-14T11:48:59","modified_gmt":"2024-11-14T03:48:59","slug":"mysql%e6%80%8e%e4%b9%88%e7%9b%b4%e6%8e%a5%e5%af%bc%e5%87%ba%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6582\/","title":{"rendered":"mysql\u600e\u4e48\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u901a\u8fc7\u4f7f\u7528 mysqldump \u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u5bfc\u51fa mysql \u6570\u636e\u5e93\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a\u6784\u5efa\u547d\u4ee4\uff1amysqldump -u \u7528\u6237\u540d -p \u5bc6\u7801 &#8211;host \u4e3b\u673a\u540d &#8211;port \u7aef\u53e3\u53f7 \u6570\u636e\u5e93\u540d &gt; \u6587\u4ef6\u540d\u6267\u884c\u547d\u4ee4\uff1a\u8f93\u5165\u547d\u4ee4\u5e76\u8f93\u5165\u5bc6\u7801\uff0c\u5bfc\u51fa\u8fc7\u7a0b\u5c06\u5f00\u59cb\u3002\u5bfc\u51fa\u7684\u6570\u636e\u5c06\u4fdd\u5b58\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/06\/2024080610524259064.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 MySQL \u4e2d\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728 MySQL \u4e2d\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u7b80\u5355\u4e14\u9ad8\u6548\u7684\u8fc7\u7a0b\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u5907\u4efd\u6570\u636e\u6216\u5c06\u5176\u4f20\u8f93\u5230\u5176\u4ed6\u7cfb\u7edf\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u64cd\u4f5c\uff1a<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u547d\u4ee4<\/strong><\/p>\n<p>\u5bfc\u51fa\u6570\u636e\u5e93\u7684\u6700\u76f4\u63a5\u65b9\u6cd5\u662f\u4f7f\u7528 mysqldump \u547d\u4ee4\u3002\u8be5\u547d\u4ee4\u9700\u8981\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li> <strong>-u \u7528\u6237\u540d\uff1a<\/strong>\u7528\u4e8e\u8fde\u63a5\u5230\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u3002<\/li>\n<li> <strong>-p \u5bc6\u7801\uff1a<\/strong>\u7528\u4e8e\u8fde\u63a5\u5230\u6570\u636e\u5e93\u7684\u5bc6\u7801\u3002<\/li>\n<li> <strong>&#8211;host \u4e3b\u673a\u540d\uff1a<\/strong>\u6570\u636e\u5e93\u6240\u5728\u7684\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\u3002<\/li>\n<li> <strong>&#8211;port \u7aef\u53e3\u53f7\uff1a<\/strong>\u7528\u4e8e\u8fde\u63a5\u5230\u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\uff08\u9ed8\u8ba4\u4e3a 3306\uff09\u3002<\/li>\n<li> <strong>\u6570\u636e\u5e93\u540d\uff1a<\/strong>\u8981\u5bfc\u51fa\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002<\/li>\n<li> <strong>\u6587\u4ef6\u540d\uff1a<\/strong>\u5bfc\u51fa\u7684\u6570\u636e\u5c06\u4fdd\u5b58\u5230\u7684\u6587\u4ef6\u7684\u540d\u79f0\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 2\uff1a\u6784\u5efa\u547d\u4ee4<\/strong><\/p>\n<p>\u4f7f\u7528\u8fd9\u4e9b\u53c2\u6570\uff0c\u4f60\u53ef\u4ee5\u6784\u5efa\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysqldump -u \u7528\u6237\u540d -p \u5bc6\u7801 --host \u4e3b\u673a\u540d --port \u7aef\u53e3\u53f7 \u6570\u636e\u5e93\u540d &gt; \u6587\u4ef6\u540d<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u6267\u884c\u547d\u4ee4<\/strong><\/p>\n<p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u7a97\u53e3\u4e2d\u6267\u884c\u8be5\u547d\u4ee4\u3002\u7cfb\u7edf\u5c06\u63d0\u793a\u4f60\u8f93\u5165\u5bc6\u7801\u3002\u8f93\u5165\u5bc6\u7801\u540e\uff0c\u5bfc\u51fa\u8fc7\u7a0b\u5c06\u5f00\u59cb\u3002\u5bfc\u51fa\u7684\u6570\u636e\u5c06\u4fdd\u5b58\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u540d\u4e2d\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5bfc\u51fa\u540d\u4e3a my_database \u7684\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5bfc\u51fa\u7684\u6570\u636e\u4fdd\u5b58\u5230\u540d\u4e3a my_database_backup.sql \u7684\u6587\u4ef6\u4e2d\uff1a<\/p>\n<pre>mysqldump -u root -p --host localhost --port 3306 my_database &gt; my_database_backup.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u4f60\u5177\u6709\u5bfc\u51fa\u6570\u636e\u5e93\u7684\u6743\u9650\u3002<\/li>\n<li>\u5bfc\u51fa\u7684\u6587\u4ef6\u662f\u4e00\u4e2a SQL \u6587\u672c\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u65b0\u521b\u5efa\u6570\u636e\u5e93\u548c\u8868\u4ee5\u53ca\u63d2\u5165\u6570\u636e\u7684\u8bed\u53e5\u3002<\/li>\n<li>\u5982\u679c\u6570\u636e\u5e93\u8f83\u5927\uff0c\u5bfc\u51fa\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u76f4\u63a5\u5bfc\u51fa\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>\u901a\u8fc7\u4f7f\u7528 mysqldump \u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u5bfc\u51fa mysql \u6570\u636e\u5e93\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a\u6784\u5efa\u547d\u4ee4\uff1amysqldump -u \u7528\u6237\u540d -p \u5bc6\u7801 &#8211;host \u4e3b\u673a\u540d &#8211;port \u7aef\u53e3\u53f7 \u6570\u636e\u5e93\u540d &gt; \u6587\u4ef6\u540d\u6267\u884c\u547d\u4ee4\uff1a\u8f93\u5165\u547d\u4ee4\u5e76\u8f93\u5165\u5bc6\u7801\uff0c\u5bfc\u51fa\u8fc7\u7a0b\u5c06\u5f00\u59cb\u3002\u5bfc\u51fa\u7684\u6570\u636e\u5c06\u4fdd\u5b58\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\u3002 \u5982\u4f55\u5728 MySQL \u4e2d\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93 \u5728 MySQL \u4e2d\u76f4\u63a5\u5bfc\u51fa\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u7b80\u5355\u4e14\u9ad8\u6548\u7684\u8fc7\u7a0b\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u5907\u4efd\u6570\u636e\u6216\u5c06\u5176\u4f20\u8f93\u5230\u5176\u4ed6\u7cfb\u7edf\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u64cd\u4f5c\uff1a \u6b65\u9aa4 1\uff1a\u4f7f\u7528 dump \u547d\u4ee4 \u5bfc\u51fa\u6570\u636e\u5e93\u7684\u6700\u76f4\u63a5\u65b9\u6cd5\u662f\u4f7f\u7528 mysqldump \u547d\u4ee4\u3002\u8be5\u547d\u4ee4\u9700\u8981\u4ee5\u4e0b\u53c2\u6570\uff1a -u \u7528\u6237\u540d\uff1a\u7528\u4e8e\u8fde\u63a5\u5230\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u3002 -p \u5bc6\u7801\uff1a\u7528\u4e8e\u8fde\u63a5\u5230\u6570\u636e\u5e93\u7684\u5bc6\u7801\u3002 &#8211;host \u4e3b\u673a\u540d\uff1a\u6570\u636e\u5e93\u6240\u5728\u7684\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\u3002 &#8211;port \u7aef\u53e3\u53f7\uff1a\u7528\u4e8e\u8fde\u63a5\u5230\u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\uff08\u9ed8\u8ba4\u4e3a 3306\uff09\u3002 \u6570\u636e\u5e93\u540d\uff1a\u8981\u5bfc\u51fa\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002 \u6587\u4ef6\u540d\uff1a\u5bfc\u51fa\u7684\u6570\u636e\u5c06\u4fdd\u5b58\u5230\u7684\u6587\u4ef6\u7684\u540d\u79f0\u3002 \u6b65\u9aa4 2\uff1a\u6784\u5efa\u547d\u4ee4 \u4f7f\u7528\u8fd9\u4e9b\u53c2\u6570\uff0c\u4f60\u53ef\u4ee5\u6784\u5efa\u4ee5\u4e0b\u547d\u4ee4\uff1a mysqldump -u \u7528\u6237\u540d -p \u5bc6\u7801 &#8211;host \u4e3b\u673a\u540d &#8211;port \u7aef\u53e3\u53f7 \u6570\u636e\u5e93\u540d [&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-6582","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6582","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=6582"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6582\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}