{"id":162863,"date":"2024-11-04T18:39:20","date_gmt":"2024-11-04T10:39:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/162863\/"},"modified":"2024-11-04T18:39:21","modified_gmt":"2024-11-04T10:39:21","slug":"%e6%95%99%e4%bd%a0%e4%bd%bf%e7%94%a8%e5%91%bd%e4%bb%a4%e8%a1%8c%e8%bc%95%e9%ac%86%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%88%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/162863\/","title":{"rendered":"\u6559\u4f60\u4f7f\u7528\u547d\u4ee4\u884c\u8f15\u9b06\u5c0e\u51fa\u6578\u64da\u5eab\uff08\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\uff09"},"content":{"rendered":"<h1 id=\"%e6%95%99%e4%bd%a0%e4%bd%bf%e7%94%a8%e5%91%bd%e4%bb%a4%e8%a1%8c%e8%bc%95%e9%ac%86%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%88%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a-xxOTLKakZI\">\u6559\u4f60\u4f7f\u7528\u547d\u4ee4\u884c\u8f15\u9b06\u5c0e\u51fa\u6578\u64da\u5eab\uff08\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\uff09<\/h1>\n<p>\u5728\u73fe\u4eca\u7684\u6578\u64da\u9a45\u52d5\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u7ba1\u7406\u548c\u7dad\u8b77\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002\u7121\u8ad6\u662f\u958b\u767c\u8005\u9084\u662f\u7cfb\u7d71\u7ba1\u7406\u54e1\uff0c\u638c\u63e1\u5982\u4f55\u4f7f\u7528\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\u90fd\u662f\u4e00\u9805\u57fa\u672c\u6280\u80fd\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u8f15\u9b06\u5c0e\u51fa\u6578\u64da\u5eab\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u6280\u5de7\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%81%b8%e6%93%87%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-xxOTLKakZI\">\u70ba\u4ec0\u9ebc\u9078\u64c7\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\uff1f<\/h2>\n<p>\u4f7f\u7528\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\u6709\u591a\u500b\u512a\u52e2\uff1a<\/p>\n<ul>\n<li><strong>\u9748\u6d3b\u6027\uff1a<\/strong>\u547d\u4ee4\u884c\u5de5\u5177\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u9078\u9805\u548c\u53c3\u6578\uff0c\u8b93\u7528\u6236\u53ef\u4ee5\u6839\u64da\u9700\u6c42\u81ea\u5b9a\u7fa9\u5c0e\u51fa\u904e\u7a0b\u3002<\/li>\n<li><strong>\u81ea\u52d5\u5316\uff1a<\/strong>\u53ef\u4ee5\u5c07\u5c0e\u51fa\u904e\u7a0b\u7de8\u5beb\u6210\u8173\u672c\uff0c\u5be6\u73fe\u81ea\u52d5\u5316\uff0c\u7bc0\u7701\u6642\u9593\u548c\u7cbe\u529b\u3002<\/li>\n<li><strong>\u8cc7\u6e90\u5360\u7528\u4f4e\uff1a<\/strong>\u76f8\u6bd4\u5716\u5f62\u754c\u9762\u5de5\u5177\uff0c\u547d\u4ee4\u884c\u5de5\u5177\u901a\u5e38\u5360\u7528\u66f4\u5c11\u7684\u7cfb\u7d71\u8cc7\u6e90\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8-mysql-%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a%e5%ba%ab-xxOTLKakZI\">\u4f7f\u7528 MySQL \u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab<\/h2>\n<p>\u5728\u9019\u88e1\uff0c\u6211\u5011\u5c07\u4ee5 MySQL \u6578\u64da\u5eab\u70ba\u4f8b\uff0c\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\u3002\u9996\u5148\uff0c\u78ba\u4fdd\u4f60\u5df2\u7d93\u5b89\u88dd\u4e86 MySQL \u5ba2\u6236\u7aef\u4e26\u4e14\u53ef\u4ee5\u901a\u904e\u547d\u4ee4\u884c\u8a2a\u554f\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-1%ef%bc%9a%e7%99%bb%e9%8c%84-mysql-xxOTLKakZI\">\u6b65\u9a5f 1\uff1a\u767b\u9304 MySQL<\/h3>\n<pre><code>mysql -u \u7528\u6236\u540d -p<\/code><\/pre>\n<p>\u5728\u57f7\u884c\u4e0a\u8ff0\u547d\u4ee4\u5f8c\uff0c\u7cfb\u7d71\u6703\u63d0\u793a\u4f60\u8f38\u5165\u5bc6\u78bc\u3002\u8f38\u5165\u6b63\u78ba\u7684\u5bc6\u78bc\u5f8c\uff0c\u4f60\u5c07\u9032\u5165 MySQL \u547d\u4ee4\u884c\u754c\u9762\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-2%ef%bc%9a%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a%e5%ba%ab-xxOTLKakZI\">\u6b65\u9a5f 2\uff1a\u5c0e\u51fa\u6578\u64da\u5eab<\/h3>\n<p>\u4f7f\u7528 <code>mysqldump<\/code> \u547d\u4ee4\u4f86\u5c0e\u51fa\u6578\u64da\u5eab\u3002\u4ee5\u4e0b\u662f\u57fa\u672c\u7684\u8a9e\u6cd5\uff1a<\/p>\n<pre><code>mysqldump -u \u7528\u6236\u540d -p \u6578\u64da\u5eab\u540d &gt; \u5c0e\u51fa\u6587\u4ef6.sql<\/code><\/pre>\n<p>\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u6578\u64da\u5eab\u540d\u70ba <code>my_database<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c0e\u51fa\uff1a<\/p>\n<pre><code>mysqldump -u root -p my_database &gt; my_database_backup.sql<\/code><\/pre>\n<p>\u9019\u6a23\u6703\u5c07 <code>my_database<\/code> \u6578\u64da\u5eab\u7684\u6240\u6709\u6578\u64da\u548c\u7d50\u69cb\u5c0e\u51fa\u5230 <code>my_database_backup.sql<\/code> \u6587\u4ef6\u4e2d\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-3%ef%bc%9a%e5%b0%8e%e5%87%ba%e7%89%b9%e5%ae%9a%e8%a1%a8-xxOTLKakZI\">\u6b65\u9a5f 3\uff1a\u5c0e\u51fa\u7279\u5b9a\u8868<\/h3>\n<p>\u5982\u679c\u4f60\u53ea\u60f3\u5c0e\u51fa\u7279\u5b9a\u7684\u8868\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u8868\u540d\uff1a<\/p>\n<pre><code>mysqldump -u \u7528\u6236\u540d -p \u6578\u64da\u5eab\u540d \u8868\u540d &gt; \u5c0e\u51fa\u6587\u4ef6.sql<\/code><\/pre>\n<p>\u4f8b\u5982\uff0c\u5c0e\u51fa <code>users<\/code> \u8868\uff1a<\/p>\n<pre><code>mysqldump -u root -p my_database users &gt; users_backup.sql<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-4%ef%bc%9a%e5%b0%8e%e5%87%ba%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b5%90%e6%a7%8b-xxOTLKakZI\">\u6b65\u9a5f 4\uff1a\u5c0e\u51fa\u6578\u64da\u5eab\u7d50\u69cb<\/h3>\n<p>\u5982\u679c\u4f60\u53ea\u60f3\u5c0e\u51fa\u6578\u64da\u5eab\u7684\u7d50\u69cb\u800c\u4e0d\u5305\u62ec\u6578\u64da\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>--no-data<\/code> \u53c3\u6578\uff1a<\/p>\n<pre><code>mysqldump -u \u7528\u6236\u540d -p --no-data \u6578\u64da\u5eab\u540d &gt; \u7d50\u69cb_backup.sql<\/code><\/pre>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre><code>mysqldump -u root -p --no-data my_database &gt; my_database_structure.sql<\/code><\/pre>\n<h2 id=\"%e5%85%b6%e4%bb%96%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%b0%8e%e5%87%ba%e6%96%b9%e6%b3%95-xxOTLKakZI\">\u5176\u4ed6\u6578\u64da\u5eab\u7684\u5c0e\u51fa\u65b9\u6cd5<\/h2>\n<p>\u9664\u4e86 MySQL\uff0c\u5176\u4ed6\u6578\u64da\u5eab\u7cfb\u7d71\u5982 PostgreSQL \u548c SQLite \u4e5f\u63d0\u4f9b\u4e86\u985e\u4f3c\u7684\u547d\u4ee4\u884c\u5de5\u5177\u4f86\u5c0e\u51fa\u6578\u64da\u5eab\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 PostgreSQL \u7684 <code>pg_dump<\/code> \u547d\u4ee4\uff1a<\/p>\n<pre><code>pg_dump -U \u7528\u6236\u540d \u6578\u64da\u5eab\u540d &gt; \u5c0e\u51fa\u6587\u4ef6.sql<\/code><\/pre>\n<p>\u5c0d\u65bc SQLite\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sqlite3 \u6578\u64da\u5eab\u540d .dump &gt; \u5c0e\u51fa\u6587\u4ef6.sql<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-xxOTLKakZI\">\u7e3d\u7d50<\/h2>\n<p>\u638c\u63e1\u547d\u4ee4\u884c\u5c0e\u51fa\u6578\u64da\u5eab\u7684\u6280\u5de7\u4e0d\u50c5\u80fd\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\uff0c\u9084\u80fd\u5e6b\u52a9\u4f60\u66f4\u597d\u5730\u7ba1\u7406\u6578\u64da\u3002\u7121\u8ad6\u662f\u4f7f\u7528 MySQL\u3001PostgreSQL \u9084\u662f SQLite\uff0c\u547d\u4ee4\u884c\u5de5\u5177\u90fd\u80fd\u63d0\u4f9b\u9748\u6d3b\u548c\u9ad8\u6548\u7684\u6578\u64da\u5c0e\u51fa\u65b9\u5f0f\u3002\u5982\u679c\u4f60\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u4f86\u904b\u884c\u4f60\u7684\u6578\u64da\u5eab\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u3002\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u7684\u8cc7\u8a0a\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528\u547d\u4ee4\u884c\u8f15\u9b06\u5c0e\u51fa\u6578\u64da\u5eab\uff0c\u638c\u63e1\u547d\u4ee4\u884c\u5c0e\u51fa\u6280\u5de7\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-162863","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/162863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=162863"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/162863\/revisions"}],"predecessor-version":[{"id":162864,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/162863\/revisions\/162864"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=162863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=162863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=162863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}