{"id":6612,"date":"2024-11-14T14:19:17","date_gmt":"2024-11-14T06:19:17","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6612\/"},"modified":"2024-11-14T14:19:17","modified_gmt":"2024-11-14T06:19:17","slug":"%e6%80%8e%e4%b9%88%e4%bf%ae%e6%94%b9mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e5%bc%95%e6%93%8e","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6612\/","title":{"rendered":"\u600e\u4e48\u4fee\u6539mysql\u6570\u636e\u5e93\u5f15\u64ce"},"content":{"rendered":"<blockquote><p>\n  \u4fee\u6539 mysql \u6570\u636e\u5e93\u5b58\u50a8\u5f15\u64ce\u7684\u6b65\u9aa4\uff1a\u505c\u6b62 mysql \u670d\u52a1\u5668\u5907\u4efd\u6570\u636e\u5e93\u4f7f\u7528 alter table \u8bed\u53e5\u4fee\u6539\u5f15\u64ce\u542f\u52a8 mysql \u670d\u52a1\u5668\u9a8c\u8bc1\u66f4\u6539\uff08show table status like &#8216;mytable&#8217;\uff09\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/13\/2024081313425272505.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u4fee\u6539mysql\u6570\u636e\u5e93\u5f15\u64ce\u63d2\u56fe\" alt=\"\u600e\u4e48\u4fee\u6539mysql\u6570\u636e\u5e93\u5f15\u64ce\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4fee\u6539 MySQL \u6570\u636e\u5e93\u5f15\u64ce<\/strong><\/p>\n<p>MySQL \u6570\u636e\u5e93\u652f\u6301\u591a\u79cd\u5b58\u50a8\u5f15\u64ce\uff0c\u6bcf\u79cd\u5f15\u64ce\u90fd\u5177\u6709\u4e0d\u540c\u7684\u7279\u6027\u548c\u6027\u80fd\u3002\u5bf9\u4e8e\u4e0d\u540c\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u9009\u62e9\u5408\u9002\u7684\u5b58\u50a8\u5f15\u64ce\u81f3\u5173\u91cd\u8981\u3002\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5b8c\u6210\u4fee\u6539 MySQL \u6570\u636e\u5e93\u5f15\u64ce\u7684\u6b65\u9aa4\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u505c\u6b62 MySQL \u670d\u52a1\u5668<\/strong><\/p>\n<p>\u5173\u95ed\u6240\u6709\u4f7f\u7528\u6570\u636e\u5e93\u7684\u5e94\u7528\u7a0b\u5e8f\u5e76\u505c\u6b62 MySQL \u670d\u52a1\u5668\uff1a<\/p>\n<pre>sudo service mysql stop<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u5907\u4efd\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728\u4fee\u6539\u5f15\u64ce\u4e4b\u524d\uff0c\u52a1\u5fc5\u5907\u4efd\u60a8\u7684\u6570\u636e\u5e93\u4ee5\u9632\uff1a<\/p>\n<pre>mysqldump -u root -p --all-databases &gt; backup.sql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u4fee\u6539\u5f15\u64ce<\/strong><\/p>\n<p>\u4f7f\u7528 ALTER TABLE \u8bed\u53e5\u4fee\u6539\u6570\u636e\u5e93\u5f15\u64ce\u3002\u4f8b\u5982\uff0c\u8981\u5c06 mytable \u8868\u7684\u5f15\u64ce\u66f4\u6539\u4e3a InnoDB\uff1a<\/p>\n<pre>ALTER TABLE mytable ENGINE=InnoDB;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u542f\u52a8 MySQL \u670d\u52a1\u5668<\/strong><\/p>\n<p>\u91cd\u65b0\u542f\u52a8 MySQL \u670d\u52a1\u5668\uff1a<\/p>\n<pre>sudo service mysql start<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u66f4\u6539<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u662f\u5426\u5df2\u6210\u529f\u4fee\u6539\u5f15\u64ce\uff1a<\/p>\n<pre>mysql -u root -p -e \"SHOW TABLE STATUS LIKE 'mytable'\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ol>\n<p><strong>\u5176\u4ed6\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5bf9\u4e8e\u4e8b\u52a1\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f7f\u7528 InnoDB \u5f15\u64ce\u3002<\/li>\n<li>\u5bf9\u4e8e\u53ea\u8bfb\u6570\u636e\uff0c\u4f7f\u7528 MyISAM \u5f15\u64ce\u3002<\/li>\n<li>\u5728\u66f4\u6539\u5f15\u64ce\u4e4b\u524d\uff0c\u8bf7\u7814\u7a76\u6bcf\u79cd\u5f15\u64ce\u7684\u4f18\u7f3a\u70b9\u3002<\/li>\n<li>\u5982\u679c\u9047\u5230\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5 MySQL \u6587\u6863\u6216\u54a8\u8be2\u6570\u636e\u5e93\u4e13\u5bb6\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u4fee\u6539\u6570\u636e\u5e93\u5f15\u64ce\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>\u4fee\u6539 mysql \u6570\u636e\u5e93\u5b58\u50a8\u5f15\u64ce\u7684\u6b65\u9aa4\uff1a\u505c\u6b62 mysql \u670d\u52a1\u5668\u5907\u4efd\u6570\u636e\u5e93\u4f7f\u7528 alter table \u8bed\u53e5\u4fee\u6539\u5f15\u64ce\u542f\u52a8 mysql \u670d\u52a1\u5668\u9a8c\u8bc1\u66f4\u6539\uff08show table status like &#8216;mytable&#8217;\uff09 \u5982\u4f55\u4fee\u6539 MySQL \u6570\u636e\u5e93\u5f15\u64ce MySQL \u6570\u636e\u5e93\u652f\u6301\u591a\u79cd\u5b58\u50a8\u5f15\u64ce\uff0c\u6bcf\u79cd\u5f15\u64ce\u90fd\u5177\u6709\u4e0d\u540c\u7684\u7279\u6027\u548c\u6027\u80fd\u3002\u5bf9\u4e8e\u4e0d\u540c\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u9009\u62e9\u5408\u9002\u7684\u5b58\u50a8\u5f15\u64ce\u81f3\u5173\u91cd\u8981\u3002\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5b8c\u6210\u4fee\u6539 MySQL \u6570\u636e\u5e93\u5f15\u64ce\u7684\u6b65\u9aa4\u3002 \u6b65\u9aa4\uff1a \u505c\u6b62 MySQL \u670d\u52a1\u5668 \u5173\u95ed\u6240\u6709\u4f7f\u7528\u6570\u636e\u5e93\u7684\u5e94\u7528\u7a0b\u5e8f\u5e76\u505c\u6b62 MySQL \u670d\u52a1\u5668\uff1a sudo service mysql stop \u767b\u5f55\u540e\u590d\u5236 \u5907\u4efd\u6570\u636e\u5e93 \u5728\u4fee\u6539\u5f15\u64ce\u4e4b\u524d\uff0c\u52a1\u5fc5\u5907\u4efd\u60a8\u7684\u6570\u636e\u5e93\u4ee5\u9632\uff1a mysqldump -u root -p &#8211;all-databases &gt; backup.sql \u767b\u5f55\u540e\u590d\u5236 \u4fee\u6539\u5f15\u64ce \u4f7f\u7528 ALTER TABLE \u8bed\u53e5\u4fee\u6539\u6570\u636e\u5e93\u5f15\u64ce\u3002\u4f8b\u5982\uff0c\u8981\u5c06 mytable \u8868\u7684\u5f15\u64ce\u66f4\u6539\u4e3a InnoDB\uff1a ALTER TABLE mytable ENGINE=InnoDB; [&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-6612","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6612","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=6612"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6612\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}