{"id":33,"date":"2009-07-21T02:36:58","date_gmt":"2009-07-20T18:36:58","guid":{"rendered":"http:\/\/broso.twbbs.org\/blojsom\/blog\/default\/ITTech\/MySQL\/?permalink=How-to-reorganize-MySQL-table-space.html"},"modified":"2009-07-21T02:36:58","modified_gmt":"2009-07-20T18:36:58","slug":"how-to-reorganize-mysql-table-space","status":"publish","type":"post","link":"https:\/\/cychien.tw\/wordpress\/2009\/07\/21\/how-to-reorganize-mysql-table-space\/","title":{"rendered":"How to reorganize MySQL table space?"},"content":{"rendered":"<p>\u6700\u8fd1\u767c\u73fe MySQL \u7684 libdata \u6a94\u6848\u5927\u5c0f\u5df2\u7d93\u8d85\u904e\u4e86 1GB\uff0c\u53ef\u80fd\u662f\u56e0\u70ba\u6bcf\u5929\u91cf\u6e2c\u516c\u53f8\u7db2\u7ad9\u6548\u80fd\u7684 raw data \u6578\u91cf\u975e\u5e38\u9f90\u5927\u7684\u7de3\u6545<more\/>\u3002\u96d6\u7136\u9019\u4e9b raw data \u505a\u5b8c\u5f59\u6574\u5206\u6790\u4e4b\u5f8c\u5c31\u6c92\u7528\u4e86\uff0c\u4f46\u662f\u5373\u4f7f\u5f9e MySQL \u4e2d\u522a\u9664\u9019\u4e9b\u8cc7\u6599\uff0c\u4f46\u662f table space \u537b\u4e0d\u6703\u56e0\u6b64\u6e1b\u5c0f\uff0c\u6240\u4ee5\u5b9a\u671f\u505a\u8cc7\u6599\u5eab table space \u7684\u91cd\u6574\u53ef\u4ee5\u589e\u52a0\u67e5\u8a62\u7684\u6548\u80fd\u3002\u6240\u4ee5\u4eca\u5929\u60f3\u60f3\u5c31\u4f86\u505a\u4e00\u4e0b MySQL table space reorganize \u5427\uff01<\/p>\n<p>\u4e0b\u9762\u662f\u6211\u7684\u7b46\u8a18\u6b65\u9a5f\uff1a<\/p>\n<p>1.\u532f\u51fa MySQL \u6240\u6709\u7684\u8cc7\u6599    <br \/>[root@broso]#$MYSQL_HOME\/bin\/mysqldump \u2013\u2013extended-insert \u2013\u2013all-databases \u2013\u2013add-drop-database \u2013\u2013disable-keys \u2013\u2013flush-privileges \u2013\u2013quick \u2013\u2013routines \u2013\u2013triggers &gt; all-databases.sql <\/p>\n<p>2.\u5c07 MySQL Server \u5b8c\u6574\u505c\u4e0b\u4f86    <br \/>[root@broso ~]#\/etc\/rc.d\/init.d\/mysql.server stop<\/p>\n<p>3.\u5c07 table space \u505a\u66f4\u540d\u6216\u5099\u4efd    <br \/>[root@broso]#cd \/var\/lib     <br \/>[root@broso]#mv mysql mysql.20090720<\/p>\n<p>4.\u91cd\u65b0\u5efa\u7acb mysql table space\uff0c\u57f7\u884c mysql_install_db script    <br \/>[root@broso]#mkdir mysql; chmod 700 mysql; chown mysql     <br \/>[root@broso]#cd $MYSQL_HOME     <br \/>[root@broso]#$MYSQL_HOME\/scripts\/scripts\/mysql_install_db<\/p>\n<p>5.\u91cd\u65b0\u555f\u52d5 MySQL Server    <br \/>[root@broso]#\/etc\/rc.d\/init.d\/mysql.server start<\/p>\n<p>6.\u8a2d\u5b9a root \u5bc6\u78bc    <br \/>[root@broso]#$MYSQL_HOME\/bin\/mysqladmin -u root password &#39;newpassword&#39;<\/p>\n<p>7.\u7528 mysql \u5de5\u5177\u7a0b\u5f0f\u5c07\u525b\u525b\u532f\u51fa\u7684\u8cc7\u6599\u91cd\u65b0\u532f\u5165    <br \/>[root@broso]$MYSQL_HOME\/bin\/mysql -u root \u2013p     <br \/>mysql&gt; SET FOREIGN_KEY_CHECKS=0;     <br \/>mysql&gt; SOURCE all-databases.sql;     <br \/>mysql&gt; SET FOREIGN_KEY_CHECKS=1;     <\/p>\n<p>8. \u5b8c\u6210<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u767c\u73fe MySQL \u7684 libdata \u6a94\u6848\u5927\u5c0f\u5df2\u7d93\u8d85\u904e\u4e86 1GB\uff0c\u53ef\u80fd\u662f\u56e0\u70ba\u6bcf\u5929\u91cf\u6e2c\u516c\u53f8\u7db2\u7ad9\u6548\u80fd\u7684 raw [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-ittechmysql"],"_links":{"self":[{"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":0,"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"wp:attachment":[{"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cychien.tw\/wordpress\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}