{"id":107807,"date":"2024-10-27T10:59:31","date_gmt":"2024-10-27T02:59:31","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=107807"},"modified":"2024-10-27T10:59:31","modified_gmt":"2024-10-27T02:59:31","slug":"dump-and-restore","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/dump-and-restore.html","title":{"rendered":"MySQL Dump and Restore,Stored Procedures and Triggers"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5b58\u50a8\u8fc7\u7a0b\u548c\u89e6\u53d1\u5668\u5728MySQL 5.0\u4e2d\u9996\u5148\u4ecb\u7ecd\u4e86\u3002\u6240\u4ee5\uff0c\u5982\u679c\u4f60\u8fd8\u5728\u4f7f\u7528MySQL\u65e7\u7248\u672c\u7684\u5b83\u5347\u7ea7\u5230MySQL 5.0\u6216\u66f4\u9ad8\u7248\u672c\u624d\u80fd\u4f7f\u7528\u8fd9\u4e9b\u529f\u80fd\u3002 \u672c\u6587\u5c06\u5e2e\u52a9\u4f60\u5982\u4f55\u8ba9\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u50a8\u548c\u4f7f\u7528mysqldump\u547d\u4ee4\u89e6\u53d1\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4ec0\u4e48\u662f\u5b58\u50a8\u8fc7\u7a0b\uff1f<\/strong><\/span><\/div>\n

\u5b58\u50a8\u8fc7\u7a0b\uff0c\u662f\u88ab\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u76ee\u5f55\uff0c\u5e76\u4e14\u53ef\u4ee5\u7531\u4e00\u4e2a\u7a0b\u5e8f\u3001\u4e00\u4e2a\u89e6\u53d1\u5668\u6216\u8005\u751a\u81f3\u4e00\u4e2a\u5b58\u50a8\u8fc7\u7a0b\u4ee5\u540e\u8c03\u7528\u7684\u58f0\u660e\u7684SQL\u4ee3\u7801\u6bb5\u3002<\/p>\n

\u4ec0\u4e48\u662f\u89e6\u53d1\u5668\uff1f<\/strong><\/span><\/div>\n

\u89e6\u53d1\u5668\u662f\u4e8b\u4ef6\u9a71\u52a8\u7684\u4e13\u5c5e\u7a0b\u5e8f\uff0c\u5b83\u4eec\u88ab\u5b58\u50a8\u4e0b\u6765\uff0c\u7531\u6570\u636e\u5e93\u7ba1\u7406\u3002\u89e6\u53d1\u5668\u662f\u53d1\u8d77\u4e00\u4e2a\u4e8b\u4ef6\u540e\u89e6\u53d1\u4e00\u4e2aSQL\u8fc7\u7a0b\uff08\u50cf\uff1aINSERT\uff0cDELETE\u6216UPDATE\uff09\u90fd\u53ef\u4ee5\u89e6\u53d1\u3002<\/p>\n

\u5f53\u6211\u4eec\u6267\u884cmysqldump \uff0c\u5b83\u4f1a\u81ea\u52a8\u89e6\u53d1\u7684\u5907\u4efd\uff0c\u4f46\u9ed8\u8ba4\u4e0d\u4f1a\u5907\u4efd\u5b58\u50a8\u8fc7\u7a0b\u3002<\/p>\n

\u5907\u4efd\u5b58\u50a8\u7a0b\u5e8f\u548c\u5e38\u89c1\u7684\u4f8b\u5b50<\/p>\n

\u6211\u4eec\u9700\u8981\u6307\u5b9a -routines \u53c2\u6570\u6765\u5b8c\u6210\u6570\u636e\u548c\u8868\u7684\u5b58\u50a8\u8fc7\u7a0b\u7684\u5907\u4efd\u3002 \u4ee5\u4e0b\u547d\u4ee4\u5c06\u5305\u62ec\u5b58\u50a8\u8fc7\u7a0b\u7684\u6574\u4e2a\u6570\u636e\u5e93\u7684\u5907\u4efd\u3002\u4f8b\u5982\u4f60\u7684\u6570\u636e\u5e93\u540d\u79f0\u4e3a\u201cmydb\u201d\u3002<\/p>\n

\r\n# mysqldump -u root -p --routines mydb > mydb.sql\r\n<\/pre>\n

\u53ea\u5907\u4efd\u5b58\u50a8\u8fc7\u7a0b\u548c\u89e6\u53d1\u5668\uff08\u65e0\u6570\u636e\u548c\u8868\u683c\uff09\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n

\r\n# mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt mydb > mydb.sql\r\n<\/pre>\n

\u6062\u590d\u5b58\u50a8\u8fc7\u7a0b<\/p>\n

\u8981\u6062\u590d\u6570\u636e\u5e93\u7684\u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528\u4e0b\u9762\u7684\u7b80\u5355\u547d\u4ee4\uff0c\u4f46\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5907\u4efd\uff0c\u4ee5\u907f\u514d\u4e4b\u524d\u4efb\u4f55\u6570\u636e\u7684\u4e22\u5931\u3002<\/p>\n

\r\n# mysql -u root -p mydb\r\n<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.howtoing.com\/mysql-dumprestore-stored-procedures-and-triggers<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/dump-and-restore.html<\/a>\u7f16\u8f91\uff1a\u4f55\u4e91\u8273\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u5b58\u50a8\u8fc7\u7a0b\u548c\u89e6\u53d1\u5668\u5728MySQL 5.0\u4e2d\u9996\u5148\u4ecb\u7ecd\u4e86\u3002\u6240\u4ee5\uff0c\u5982\u679c\u4f60\u8fd8\u5728\u4f7f\u7528MySQL\u65e7\u7248\u672c\u7684\u5b83\u5347\u7ea7\u5230MySQ […]<\/p>\n","protected":false},"author":1479,"featured_media":4820,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-107807","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=107807"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107807\/revisions"}],"predecessor-version":[{"id":293985,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107807\/revisions\/293985"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/4820"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=107807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=107807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=107807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}