{"id":12261,"date":"2023-06-29T13:43:43","date_gmt":"2023-06-29T05:43:43","guid":{"rendered":"https:\/\/fick707.com\/?p=12261"},"modified":"2023-06-29T13:43:43","modified_gmt":"2023-06-29T05:43:43","slug":"mysql-%e5%a4%87%e4%bb%bd%e5%8f%8a%e8%bf%98%e5%8e%9f","status":"publish","type":"post","link":"https:\/\/fick707.com\/?p=12261","title":{"rendered":"MySQL \u5907\u4efd\u53ca\u8fd8\u539f"},"content":{"rendered":"<p><a href=\"https:\/\/blog.csdn.net\/gong_wejoy\/article\/details\/121764618\">\u8f6c\u8f7d\u81ea\u8fd9\u91cc<\/a><\/p>\n<h1><strong>\u4e00\u3001mysqldump \u7b80\u4ecb<\/strong><\/h1>\n<p>mysqldump \u662f MySQL \u81ea\u5e26\u7684\u903b\u8f91\u5907\u4efd\u5de5\u5177\u3002\u5b83\u7684\u5907\u4efd\u539f\u7406\u662f\u901a\u8fc7\u534f\u8bae\u8fde\u63a5\u5230 MySQL \u6570\u636e\u5e93\uff0c\u5c06\u9700\u8981\u5907\u4efd\u7684\u6570\u636e\u67e5\u8be2\u51fa\u6765\uff0c\u5c06\u67e5\u8be2\u51fa\u7684\u6570\u636e\u8f6c\u6362\u6210\u5bf9\u5e94\u7684insert \u8bed\u53e5\uff0c\u5f53\u6211\u4eec\u9700\u8981\u8fd8\u539f\u8fd9\u4e9b\u6570\u636e\u65f6\uff0c\u53ea\u8981\u6267\u884c\u8fd9\u4e9b insert \u8bed\u53e5\uff0c\u5373\u53ef\u5c06\u5bf9\u5e94\u7684\u6570\u636e\u8fd8\u539f\u3002<\/p>\n<h1><strong>\u4e8c\u3001\u5907\u4efd\u547d\u4ee4<\/strong><\/h1>\n<h2><strong>2.1 \u547d\u4ee4\u683c\u5f0f<\/strong><\/h2>\n<p>mysqldump [\u9009\u9879] \u6570\u636e\u5e93\u540d [\u8868\u540d] &gt; \u811a\u672c\u540d<br \/>\nmysqldump [\u9009\u9879] &#8211;\u6570\u636e\u5e93\u540d [\u9009\u9879 \u8868\u540d] &gt; \u811a\u672c\u540d<br \/>\nmysqldump [\u9009\u9879] &#8211;all-databases [\u9009\u9879] &gt; \u811a\u672c\u540d<\/p>\n<h2><strong>2.2 \u9009\u9879\u8bf4\u660e<\/strong><\/h2>\n<p>\u53c2\u6570\u540d \u7f29\u5199 \u542b\u4e49<br \/>\n&#8211;host -h \u670d\u52a1\u5668IP\u5730\u5740<br \/>\n&#8211;port -P \u670d\u52a1\u5668\u7aef\u53e3\u53f7<br \/>\n&#8211;user -u MySQL \u7528\u6237\u540d<br \/>\n&#8211;pasword -p MySQL \u5bc6\u7801<br \/>\n&#8211;databases \u6307\u5b9a\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93<br \/>\n&#8211;all-databases \u5907\u4efdmysql\u670d\u52a1\u5668\u4e0a\u7684\u6240\u6709\u6570\u636e\u5e93<br \/>\n&#8211;compact \u538b\u7f29\u6a21\u5f0f\uff0c\u4ea7\u751f\u66f4\u5c11\u7684\u8f93\u51fa<br \/>\n&#8211;comments \u6dfb\u52a0\u6ce8\u91ca\u4fe1\u606f<br \/>\n&#8211;complete-insert \u8f93\u51fa\u5b8c\u6210\u7684\u63d2\u5165\u8bed\u53e5<br \/>\n&#8211;lock-tables \u5907\u4efd\u524d\uff0c\u9501\u5b9a\u6240\u6709\u6570\u636e\u5e93\u8868<br \/>\n&#8211;no-create-db\/&#8211;no-create-info \u7981\u6b62\u751f\u6210\u521b\u5efa\u6570\u636e\u5e93\u8bed\u53e5<br \/>\n&#8211;force \u5f53\u51fa\u73b0\u9519\u8bef\u65f6\u4ecd\u7136\u7ee7\u7eed\u5907\u4efd\u64cd\u4f5c<br \/>\n&#8211;default-character-set \u6307\u5b9a\u9ed8\u8ba4\u5b57\u7b26\u96c6<br \/>\n&#8211;add-locks \u5907\u4efd\u6570\u636e\u5e93\u8868\u65f6\u9501\u5b9a\u6570\u636e\u5e93\u8868<\/p>\n<h2><strong>2.3 \u5b9e\u4f8b<\/strong><\/h2>\n<p>\u5907\u4efd\u6240\u6709\u6570\u636e\u5e93\uff1a<br \/>\nmysqldump -uroot -p &#8211;all-databases &gt; \/backup\/mysqldump\/all.db<\/p>\n<p>\u5907\u4efd\u6307\u5b9a\u6570\u636e\u5e93\uff1a<br \/>\nmysqldump -uroot -p test &gt; \/backup\/mysqldump\/test.db<\/p>\n<p>\u5907\u4efd\u6307\u5b9a\u6570\u636e\u5e93\u6307\u5b9a\u8868(\u591a\u4e2a\u8868\u4ee5\u7a7a\u683c\u95f4\u9694)<br \/>\nmysqldump -uroot -p mysql db event &gt; \/backup\/mysqldump\/2table.db<\/p>\n<p>\u5907\u4efd\u6307\u5b9a\u6570\u636e\u5e93\u6392\u9664\u67d0\u4e9b\u8868<br \/>\nmysqldump -uroot -p test &#8211;ignore-table=test.t1 &#8211;ignore-table=test.t2 &gt; \/backup\/mysqldump\/test2.db<\/p>\n<h1><strong>\u4e09\u3001\u8fd8\u539f\u547d\u4ee4<\/strong><\/h1>\n<h2><strong>3.1 \u7cfb\u7edf\u884c\u547d\u4ee4<\/strong><\/h2>\n<p>\u683c\u5f0f\uff1amysql -h[ip] -P[(\u5927\u5199)\u7aef\u53e3] -u[\u7528\u6237\u540d] -p[\u5bc6\u7801] [\u6570\u636e\u5e93\u540d] &lt; d:XX.sql(\u8def\u5f84)<br \/>\n\u5bfc\u5165\u547d\u4ee4\uff1amysql -uroot -proot -h127.0.0.1 -P3306 education&lt;d:\/database.sql<br \/>\n\u5bfc\u5165\u547d\u4ee4\uff1amysql -uroot -proot -h127.0.0.1 -P3306 &lt;d:\/all_database.sql<\/p>\n<h2><strong>3.2 soure \u65b9\u6cd5<\/strong><\/h2>\n<p>mysql &gt; use db_name<br \/>\nmysql &gt; source \/backup\/mysqldump\/db_name.db<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u81ea\u8fd9\u91cc \u4e00\u3001mysqldump \u7b80\u4ecb mysqldump \u662f MySQL \u81ea\u5e26\u7684\u903b\u8f91\u5907\u4efd\u5de5\u5177\u3002\u5b83 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[21],"series":[],"class_list":["post-12261","post","type-post","status-publish","format-standard","hentry","category-programmers","tag-mysql"],"_links":{"self":[{"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts\/12261"}],"collection":[{"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12261"}],"version-history":[{"count":1,"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts\/12261\/revisions"}],"predecessor-version":[{"id":12262,"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts\/12261\/revisions\/12262"}],"wp:attachment":[{"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12261"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=12261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}