{"id":216,"date":"2021-07-13T17:20:48","date_gmt":"2021-07-13T09:20:48","guid":{"rendered":"https:\/\/dasmz.com\/?p=216"},"modified":"2022-06-17T13:48:52","modified_gmt":"2022-06-17T05:48:52","slug":"%e5%a4%87%e4%bb%bd%e5%8d%9a%e5%ae%a2%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93-%e5%a4%87%e4%bb%bd%e7%bd%91%e7%ab%99%e7%9a%84%e8%b5%84%e6%96%99-2021-7-13","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=216","title":{"rendered":"\u5907\u4efd\u535a\u5ba2\u670d\u52a1\u5668\u7684MySQL\u6570\u636e\u5e93 \u5907\u4efd\u7f51\u7ad9\u7684\u8d44\u6599 2021-7-13"},"content":{"rendered":"<p>\u9700\u6c42\u63cf\u8ff0<br>\u5907\u4efd\u672c\u535a\u5ba2\u7f51\u7ad9\u7684\u6570\u636e\u5e93\uff0c\u6570\u636e\u8d44\u6599\uff0c\u5907\u4efd\u9891\u73871\u6b21\/\u5929\uff0c\u670d\u52a1\u5668\u6e90\u7ad9\u4f4d\u4e8e\u7f8e\u56fd\uff0c\u5907\u4efd\u6570\u636e\u5f02\u5730\u5bb9\u707e\uff0c\u4f20\u8f93\u5230\u4e2d\u56fd\u4e00\u4efd\uff0c\u4f20\u8f93\u5230\u65e5\u672c\u670d\u52a1\u5668\u4e00\u4efd\u3002<br>\u6570\u636e\u5b9e\u73b0\u4e00\u4e3b\uff0c\u4e24\u5907\u4efd\u526f\u672c\uff0c\u5373\u4fbf\u4e3b\u7f51\u7ad9\u5b8c\u5168\u5d29\u6e83\uff0c\u53ef\u4ee5\u5b9e\u73b0\uff0c\u5feb\u901f\u7684\u6570\u636e\u6062\u590d\uff0c\u7f51\u7ad9\u91cd\u5efa\u3002<\/p>\n<p>\u535a\u5ba2\u7f51\u7ad9\u7684\u5907\u4efd\uff0c\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u6570\u636e\u5e93\u90e8\u5206\u548c\u7f51\u7ad9\u6587\u4ef6\u90e8\u5206\u3002<\/p>\n<p>\u5907\u4efd\u811a\u672c\u5df2\u4e0a\u4f20Github\uff0c\u8fd0\u884c\u5728\u6e90\u7ad9\u670d\u52a1\u5668\u4e0a<\/p>\n<p><a href=\"https:\/\/github.com\/fdmove\/BlockADS\/blob\/main\/BackBlog.sh\">https:\/\/github.com\/fdmove\/BlockADS\/blob\/main\/BackBlog.sh<\/a><\/p>\n<p>\u9884\u89c8<\/p>\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh\n# START\nmkdir -p \/root\/sh \/root\/backup\nv_date=`date '+%Y%m%d'`\nDB_USER='root'\nDB_PASS='DBPASS'\nDB_NAME='DBNAME'\nDB_HOST='127.0.0.1'\n\n# \u5907\u4efd\u6570\u636e\u5e93\nmysqldump -h ${DB_HOST} -u ${DB_USER} -p${DB_PASS} --databases ${DB_NAME} &gt; \/root\/backup\/Backup.myBlog.mysqldump.${v_date}.SQL\n\n# \u5907\u4efd\u7f51\u7ad9\u7684\u6587\u4ef6\nv_blog='dasmz.com'\ncd \/var\/www\/\ntar -zcvf \/root\/backup\/Backup.${v_blog}.${v_date}.tar.gz ${v_blog}\n\n# \u5220\u9664\u65e7\u7684\u5907\u4efd\ncd \/root\/backup\nfind . -name *.tar.gz -type f -ctime +90 -print | xargs rm \nfind . -name *.SQL    -type f -ctime +90 -print | xargs rm\n\n# END<\/pre>\n\n\n\n<p><em>\u5907\u6ce81 \u4f9d\u636e\u670d\u52a1\u5668\u78c1\u76d8\u5927\u5c0f\uff0c\u9009\u62e9\u4fdd\u7559\u7684\u6570\u636e\u91cf<\/em><\/p>\n\n\n\n<p><em>\u5907\u6ce82 \u5b9e\u9645\u60c5\u51b5\u4e0b\uff0c\u4e2a\u4eba\u535a\u5ba2\u7f51\u7ad9\uff0c\u4e00\u822c\u4e00\u4e3b\u4e00\u5907\u5c31\u8db3\u591f\u4e86\uff0c\u5355\u4f53\u6570\u636e\u91cf\u5168\u91cf\u548c\u589e\u91cf\u90fd\u6bd4\u8f83\u5c0f\uff0c\u4e0d\u9700\u8981\u9ad8\u5bc6\u5ea6\u5907\u4efd<\/em><\/p>\n\n\n\n<p>\u6e90\u7ad9\u670d\u52a1\u5668\uff0ccron\u4efb\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u5907\u4efd\u6570\u636e\u5e93 \u548c \u7f51\u7ad9\u7684\u6587\u4ef6  20210713\n10 0 * * * \/root\/sh\/BackBlog.sh &gt; \/root\/log\/BackBlog.log<\/pre>\n\n\n\n<p>\u5907\u4efd\u7684\u6587\u4ef6\u5728\u6e90\u7ad9\u670d\u52a1\u5668\u751f\u6210\u540e\uff0c\u53ef\u4ee5\u7528\u4e00\u4e9bsync\u5de5\u5177\uff0c\u5b9a\u65f6\u540c\u6b65\u5230\u5176\u4ed6\u5907\u4efd\u8282\u70b9\u7684\u78c1\u76d8\u4e0a\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"574\" height=\"446\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2020\/12\/DONATE.jpg\" alt=\"Donate\" class=\"wp-image-18\" style=\"border:2px solid yellow\"\/><figcaption>\u4e91\u4e5e\u8ba8<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42\u63cf\u8ff0\u5907\u4efd\u672c\u535a\u5ba2\u7f51\u7ad9\u7684\u6570\u636e\u5e93\uff0c\u6570\u636e\u8d44\u6599\uff0c\u5907\u4efd\u9891\u73871\u6b21\/\u5929\uff0c\u670d\u52a1\u5668\u6e90\u7ad9\u4f4d\u4e8e\u7f8e\u56fd\uff0c\u5907\u4efd\u6570\u636e\u5f02\u5730\u5bb9\u707e\uff0c\u4f20\u8f93\u5230\u4e2d\u56fd\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/216"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=216"}],"version-history":[{"count":8,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/216\/revisions"}],"predecessor-version":[{"id":2420,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/216\/revisions\/2420"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}