{"id":6465,"date":"2024-11-14T15:07:29","date_gmt":"2024-11-14T07:07:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6465\/"},"modified":"2024-11-14T15:07:29","modified_gmt":"2024-11-14T07:07:29","slug":"%e6%80%8e%e4%b9%88%e5%88%a0%e9%99%a4%e5%ae%89%e8%a3%85%e7%9a%84mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6465\/","title":{"rendered":"\u600e\u4e48\u5220\u9664\u5b89\u88c5\u7684mysql\u6570\u636e\u5e93\u6587\u4ef6"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5220\u9664\u5df2\u5b89\u88c5\u7684 mysql \u6570\u636e\u5e93\u6587\u4ef6\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u505c\u6b62 mysql \u670d\u52a1\u5907\u4efd\u6570\u636e\u5e93\uff08\u53ef\u9009\uff09\u5220\u9664\u6570\u636e\u76ee\u5f55\u5220\u9664\u914d\u7f6e\u6587\u4ef6\u5220\u9664\u65e5\u5fd7\u6587\u4ef6\u91cd\u65b0\u5b89\u88c5 mysql\uff08\u53ef\u9009\uff09\u542f\u52a8 mysql \u670d\u52a1\u73b0\u5728\uff0c\u60a8\u5df2\u6210\u529f\u5220\u9664\u4e86\u5df2\u5b89\u88c5\u7684 mysql \u6570\u636e\u5e93\u6587\u4ef6\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080508041633095.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u5220\u9664\u5b89\u88c5\u7684mysql\u6570\u636e\u5e93\u6587\u4ef6\u63d2\u56fe\" alt=\"\u600e\u4e48\u5220\u9664\u5b89\u88c5\u7684mysql\u6570\u636e\u5e93\u6587\u4ef6\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5220\u9664\u5df2\u5b89\u88c5\u7684 MySQL \u6570\u636e\u5e93\u6587\u4ef6<\/strong><\/p>\n<p>\u8981\u5220\u9664\u5df2\u5b89\u88c5\u7684 MySQL \u6570\u636e\u5e93\u6587\u4ef6\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u505c\u6b62 MySQL \u670d\u52a1<\/strong><\/p>\n<p>\u9996\u5148\uff0c\u786e\u4fdd MySQL \u670d\u52a1\u5df2\u505c\u6b62\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo service mysql stop<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u5907\u4efd\u6570\u636e\u5e93\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u5728\u5220\u9664\u6570\u636e\u5e93\u6587\u4ef6\u4e4b\u524d\uff0c\u5efa\u8bae\u5907\u4efd\u6570\u636e\u5e93\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 dump \u5b9e\u7528\u7a0b\u5e8f\u6765\u6267\u884c\u6b64\u64cd\u4f5c\uff1a<\/p>\n<pre>mysqldump -u root -p --all-databases &gt; my_database_backup.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u5220\u9664\u6570\u636e\u76ee\u5f55<\/strong><\/p>\n<p>MySQL \u6570\u636e\u5e93\u6587\u4ef6\u5b58\u50a8\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6b64\u76ee\u5f55\u4e3a \/var\/lib\/mysql\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u8be5\u76ee\u5f55\uff1a<\/p>\n<pre>sudo rm -rf \/var\/lib\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u5220\u9664\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<p>MySQL \u914d\u7f6e\u6587\u4ef6\u5b58\u50a8\u5728 \/etc\/mysql\/my.cnf \u4e2d\u3002\u5220\u9664\u6b64\u6587\u4ef6\uff1a<\/p>\n<pre>sudo rm \/etc\/mysql\/my.cnf<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u5220\u9664\u65e5\u5fd7\u6587\u4ef6<\/strong><\/p>\n<p>MySQL \u65e5\u5fd7\u6587\u4ef6\u5b58\u50a8\u5728 \/var\/log\/mysql \u4e2d\u3002\u5220\u9664\u6b64\u76ee\u5f55\uff1a<\/p>\n<pre>sudo rm -rf \/var\/log\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u91cd\u65b0\u5b89\u88c5 MySQL\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u60f3\u8981\u91cd\u65b0\u5b89\u88c5 MySQL\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo apt-get install mysql-server<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>7. \u542f\u52a8 MySQL \u670d\u52a1<\/strong><\/p>\n<p>\u6700\u540e\uff0c\u542f\u52a8 MySQL \u670d\u52a1\uff1a<\/p>\n<pre>sudo service mysql start<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u5df2\u6210\u529f\u5220\u9664\u4e86\u5df2\u5b89\u88c5\u7684 MySQL \u6570\u636e\u5e93\u6587\u4ef6\u3002\u8bf7\u6ce8\u610f\uff0c\u6b64\u8fc7\u7a0b\u5c06\u5220\u9664\u6240\u6709\u6570\u636e\u5e93\u548c\u6570\u636e\uff0c\u56e0\u6b64\u5728\u5220\u9664\u6587\u4ef6\u4e4b\u524d\u786e\u4fdd\u60a8\u5df2\u5907\u4efd\u4e86\u6570\u636e\u5e93\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5220\u9664\u5b89\u88c5\u7684\u6570\u636e\u5e93\u6587\u4ef6\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>\u8981\u5220\u9664\u5df2\u5b89\u88c5\u7684 mysql \u6570\u636e\u5e93\u6587\u4ef6\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u505c\u6b62 mysql \u670d\u52a1\u5907\u4efd\u6570\u636e\u5e93\uff08\u53ef\u9009\uff09\u5220\u9664\u6570\u636e\u76ee\u5f55\u5220\u9664\u914d\u7f6e\u6587\u4ef6\u5220\u9664\u65e5\u5fd7\u6587\u4ef6\u91cd\u65b0\u5b89\u88c5 mysql\uff08\u53ef\u9009\uff09\u542f\u52a8 mysql \u670d\u52a1\u73b0\u5728\uff0c\u60a8\u5df2\u6210\u529f\u5220\u9664\u4e86\u5df2\u5b89\u88c5\u7684 mysql \u6570\u636e\u5e93\u6587\u4ef6\u3002 \u5982\u4f55\u5220\u9664\u5df2\u5b89\u88c5\u7684 MySQL \u6570\u636e\u5e93\u6587\u4ef6 \u8981\u5220\u9664\u5df2\u5b89\u88c5\u7684 MySQL \u6570\u636e\u5e93\u6587\u4ef6\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u505c\u6b62 MySQL \u670d\u52a1 \u9996\u5148\uff0c\u786e\u4fdd MySQL \u670d\u52a1\u5df2\u505c\u6b62\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a sudo service mysql stop \u767b\u5f55\u540e\u590d\u5236 2. \u5907\u4efd\u6570\u636e\u5e93\uff08\u53ef\u9009\uff09 \u5728\u5220\u9664\u6570\u636e\u5e93\u6587\u4ef6\u4e4b\u524d\uff0c\u5efa\u8bae\u5907\u4efd\u6570\u636e\u5e93\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 dump \u5b9e\u7528\u7a0b\u5e8f\u6765\u6267\u884c\u6b64\u64cd\u4f5c\uff1a mysqldump -u root -p &#8211;all-databases &gt; my_database_backup.sql \u767b\u5f55\u540e\u590d\u5236 3. \u5220\u9664\u6570\u636e\u76ee\u5f55 MySQL \u6570\u636e\u5e93\u6587\u4ef6\u5b58\u50a8\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6b64\u76ee\u5f55\u4e3a \/var\/lib\/mysql\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u8be5\u76ee\u5f55\uff1a sudo rm -rf \/var\/lib\/mysql \u767b\u5f55\u540e\u590d\u5236 4. \u5220\u9664\u914d\u7f6e\u6587\u4ef6 MySQL \u914d\u7f6e\u6587\u4ef6\u5b58\u50a8\u5728 [&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-6465","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6465","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=6465"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6465\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}