{"id":31,"date":"2019-11-04T17:22:40","date_gmt":"2019-11-04T09:22:40","guid":{"rendered":"http:\/\/47.110.70.105\/wordpress\/?p=31"},"modified":"2019-11-04T17:29:26","modified_gmt":"2019-11-04T09:29:26","slug":"%e4%bf%ae%e5%a4%8dtable-xxx-is-marked-as-crashed-and-should-be-repaired","status":"publish","type":"post","link":"http:\/\/43.139.139.10\/wordpress\/31\/","title":{"rendered":"\u4fee\u590dTable &#8216;XXX&#8217; is marked as crashed and should be repaired"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>1\u3001\u767b\u5f55liunx\u670d\u52a1\u5668\n2\u3001cd \/home\/MysqlData\/\u6570\u636e\u5e93\u540d\n3\u3001myisamchk -c -r \u8868\u540d.MYI\u200b\n\n\u65e0\u6cd5\u4fee\u590d\u65f6\u53ef\u5c1d\u8bd5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\n\nmyisamchk -r -f \u8868\u540d.MYI -o -q\n\n<\/code><\/pre>\n\n\n\n<p>myisamchk\u547d\u4ee4\u4f7f\u7528\u603b\u7ed3:<\/p>\n\n\n\n<p>myisamchk\u5b9e\u7528\u7a0b\u5e8f\u53ef\u4ee5\u7528\u6765\u83b7\u5f97\u6709\u5173\u4f60\u7684\u6570\u636e\u5e93\u8868\u7684\u7edf\u8ba1\u4fe1\u606f\u6216\u68c0\u67e5\u3001\u4fee\u590d\u3001\u4f18\u5316\u4ed6\u4eec<\/p>\n\n\n\n<p>1.\u5e38\u7528\u4e8emyisamchk\u7684\u68c0\u67e5\u9009\u9879<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>--information, -i\n\u6253\u5370\u6240\u68c0\u67e5\u8868\u7684\u7edf\u8ba1\u4fe1\u606f\u3002\n\n--fast\uff0c-F\n\u53ea\u68c0\u67e5\u6ca1\u6709\u6b63\u786e\u5173\u95ed\u7684\u8868\u3002\n\n--force, -f\n\u5982\u679cmyisamchk\u53d1\u73b0\u8868\u5185\u6709\u4efb\u4f55\u9519\u8bef\uff0c\u5219\u81ea\u52a8\u8fdb\u884c\u4fee\u590d\u3002\u7ef4\u62a4\u7c7b\u578b\u4e0e-r\u9009\u9879\u6307\u5b9a\u7684\u76f8\u540c\u3002\n\n--medium-check, -m\n\u6bd4--extend-check\u66f4\u5feb\u901f\u5730\u8fdb\u884c\u68c0\u67e5\u3002\u53ea\u80fd\u53d1\u73b099.99%\u7684\u9519\u8bef\uff0c\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u5c31\u8db3\u591f\u4e86\u3002\n\n\u957f\u7528\u547d\u4ee4\u5982\u4e0b\uff1a\n\u5feb\u901f\u7684\u68c0\u67e5\n<\/code><\/pre>\n\n\n<p>[root@localhost ~]<\/p>\n\n\n\n<p># myisamchk -im \/var\/lib\/mysql\/backup\/t1\n\n\u53ea\u68c0\u67e5\u6ca1\u6709\u6b63\u5e38\u5173\u95ed\u7684\u8868\n<\/p>\n\n\n<p>[root@localhost ~]<\/p>\n\n\n\n<p># myisamchk -iFm \/var\/lib\/mysql\/backup\/*\n\n\u4ec5\u663e\u793a\u8868\u7684\u6700\u91cd\u8981\u7684\u4fe1\u606f\n<\/p>\n\n\n<p>[root@localhost backup]<\/p>\n\n\n\n<p># myisamchk -eis \/var\/lib\/mysql\/backup\/t1\n<\/p>\n\n\n\n<p>2.\u957f\u7528\u4e8emyisamchk\u7684\u4fee\u590d\u9009\u9879<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>--backup, -B\n\u5c06.MYD\u6587\u4ef6\u5907\u4efd\u4e3afile_name-time.BAK\n\n--correct-checksum\n\u7ea0\u6b63\u8868\u7684\u6821\u9a8c\u548c\u4fe1\u606f\u3002\n\n--force, -f\n\u8986\u76d6\u65e7\u7684\u4e2d\u95f4\u6587\u4ef6(\u6587\u4ef6\u540d\u7c7b\u4f3ctbl_name.TMD)\uff0c\u800c\u4e0d\u662f\u4e2d\u65ad\u3002\n\n--quick\uff0c-q\n\u4e0d\u4fee\u6539\u6570\u636e\u6587\u4ef6\uff0c\u5feb\u901f\u8fdb\u884c\u4fee\u590d\u3002\u51fa\u73b0\u590d\u5236\u952e\u65f6\uff0c\u4f60\u53ef\u4ee5\u4e24\u6b21\u6307\u5b9a\u8be5\u9879\u4ee5\u5f3a\u5236myisamchk\u4fee\u6539\u539f\u6570\u636e\u6587\u4ef6\u3002\n\n--recover, -r\n\u53ef\u4ee5\u4fee\u590d\u51e0\u4e4e\u6240\u6709\u4e00\u5207\u95ee\u9898\uff0c\u9664\u975e\u552f\u4e00\u7684\u952e\u4e0d\u552f\u4e00\u65f6(\u5bf9\u4e8eMyISAM\u8868\uff0c\u8fd9\u662f\u975e\u5e38\u4e0d\u53ef\u80fd\u7684\u60c5\u51b5)\u3002\u5982\u679c\u4f60\u60f3\u8981\u6062\u590d\u8868\uff0c\u8fd9\u662f\u9996\u5148\u8981\u5c1d\u8bd5\u7684\u9009\u9879\u3002\u5982\u679cmyisamchk\u62a5\u544a\u8868\u4e0d\u80fd\u7528-r\u6062\u590d\uff0c\u5219\u53ea\u80fd\u5c1d\u8bd5-o\u3002\u5982\u679c\u4f60\u6709\u5927\u91cf\u5185\u5b58\uff0c\u4f60\u5e94\u589e\u52a0sort_buffer_size\u7684\u503c\u3002\n\n--safe-recover, -o\n\u4f7f\u7528\u4e00\u4e2a\u8001\u7684\u6062\u590d\u65b9\u6cd5\u8bfb\u53d6\uff0c\u6309\u987a\u5e8f\u8bfb\u53d6\u6240\u6709\u884c\uff0c\u5e76\u6839\u636e\u627e\u5230\u7684\u884c\u66f4\u65b0\u6240\u6709\u7d22\u5f15\u6811\u3002\u8fd9\u6bd4-r\u6162\u4e9b\uff0c\u4f46\u662f\u80fd\u5904\u7406-r\u4e0d\u80fd\u5904\u7406\u7684\u60c5\u51b5\u3002\u8be5\u6062\u590d\u65b9\u6cd5\u4f7f\u7528\u7684\u786c\u76d8\u7a7a\u95f4\u6bd4-r\u5c11\u3002\u4e00\u822c\u60c5\u51b5\uff0c\u4f60\u5e94\u9996\u5148\u7528-r\u7ef4\u4fee\uff0c\u5982\u679c-r\u5931\u8d25\u5219\u7528-o\u3002\u5982\u679c\u4f60\u6709\u5927\u91cf\u5185\u5b58\uff0c\u4f60\u5e94\u589e\u52a0sort_buffer_size\u7684\u503c\u3002\n\n--tmpdir=path, -t path\n\u7528\u4e8e\u4fdd\u5b58\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u7684\u8def\u5f84\u3002\u5982\u679c\u672a\u8bbe\u7f6e\uff0cmyisamchk\u4f7f\u7528TMPDIR\u73af\u5883\u53d8\u91cf\u7684\u503c\u3002tmpdir\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u4e00\u7cfb\u5217\u76ee\u5f55\u8def\u5f84\uff0c\u7528\u4e8e\u6210\u529f\u5730\u4ee5round-robin\u6a21\u5f0f\u521b\u5efa\u4e34\u65f6\u6587\u4ef6\u3002\u5728Unix\u4e2d\uff0c\u76ee\u5f55\u540d\u4e4b\u95f4\u7684\u95f4\u9694\u5b57\u7b26\u4e3a\u5192\u53f7(\u2018:\u2019)\uff0c\u5728Windows\u3001NetWare\u548cOS\/2\u4e2d\u4e3a\u5206\u53f7 (\u2018\uff1b\u2019)\u3002\n\n--unpack\uff0c-u\n\u5c06\u7528myisampack\u6253\u5305\u7684\u8868\u89e3\u5305\u3002\n\n\u5e38\u7528\u6062\u590d\u547d\u4ee4\uff1a\n\u9996\u5148\u5c1d\u8bd5\u7528\u8fd9\u79cd\u6062\u590d\u65b9\u5f0f\n<\/code><\/pre>\n\n\n<p>[root@localhost ~]<\/p>\n\n\n\n<p># myisamchk -iBfqr \/var\/lib\/mysql\/backup\/t1\n\u5982\u679c\u4e0a\u9762\u7684\u6062\u590d\u5931\u8d25\uff0c\u518d\u5c1d\u8bd5\u7528\u5982\u4e0b\u7684\u65b9\u5f0f\uff0c\u8fd9\u4e2a\u6bd4\u8f83\u6162\n<\/p>\n\n\n<p>[root@localhost ~]# myisamchk -iBfqo \/var\/lib\/mysql\/backup\/t1 <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>3.\u957f\u7528\u4e8emyisamchk\u7684\u5206\u6790\u9009\u9879<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>--analyze\uff0c-a\n\u5206\u6790\u952e\u503c\u7684\u5206\u5e03\u3002\u8fd9\u901a\u8fc7\u8ba9\u8054\u7ed3\u4f18\u5316\u5668\u66f4\u597d\u5730\u9009\u62e9\u8868\u5e94\u8be5\u4ee5\u4ec0\u4e48\u6b21\u5e8f\u8054\u7ed3\u548c\u5e94\u8be5\u4f7f\u7528\u54ea\u4e2a\u952e\u6765\u6539\u8fdb\u8054\u7ed3\u6027\u80fd\u3002\u8981\u60f3\u83b7\u53d6\u5206\u5e03\u76f8\u5173\u4fe1\u606f\uff0c\u4f7f\u7528\u5982\u4e0b\u4e24\u4e2a\u547d\u4ee4\nmysql> show keys from t1;\n\u6216\n<\/code><\/pre>\n\n\n<p>[root@localhost ~]<\/p>\n\n\n\n<p># myisamchk &#8211;description &#8211;verbose \/var\/lib\/mysql\/backup\/t1\n\n&#8211;description, -d\n\u6253\u5370\u51fa\u5173\u4e8e\u8868\u7684\u63cf\u8ff0\u6027\u4fe1\u606f\n\n&#8211;sort-index, -S\n\u4ee5\u4ece\u9ad8\u5230\u4f4e\u7684\u987a\u5e8f\u6392\u5e8f\u7d22\u5f15\u6811\u5757\u3002\u8fd9\u5c06\u4f18\u5316\u641c\u5bfb\u5e76\u4e14\u5c06\u4f7f\u6309\u952e\u503c\u7684\u8868\u626b\u63cf\u66f4\u5feb\u3002\n\n&#8211;sort-records=N, -R N\n\u6839\u636e\u4e00\u4e2a\u5177\u4f53\u7d22\u5f15\u6392\u5e8f\u8bb0\u5f55\u3002\u8fd9\u4f7f\u4f60\u7684\u6570\u636e\u66f4\u5c40\u90e8\u5316\u5e76\u4e14\u53ef\u4ee5\u52a0\u5feb\u5728\u8be5\u952e\u4e0a\u7684SELECT\u548cORDER BY\u7684\u8303\u56f4\u641c\u7d22\u3002\uff08\u7b2c\u4e00\u6b21\u505a\u6392\u5e8f\u53ef\u80fd\u5f88\u6162\uff01\uff09\u4e3a\u4e86\u627e\u51fa\u4e00\u5f20\u8868\u7684\u7d22\u5f15\u7f16\u53f7\uff0c\u4f7f\u7528SHOW INDEX\uff0c\u5b83\u4ee5myisamchk\u770b\u89c1\u4ed6\u4eec\u7684\u76f8\u540c\u987a\u5e8f\uff0c\u663e\u793a\u4e00\u5f20\u8868\u7684\u7d22\u5f15\u3002\u7d22\u5f15\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002\n\n\u5982\u679c\u952e\u6ca1\u6709\u6253\u5305(PACK_KEYS=0)\uff0c\u5b83\u4eec\u7684\u957f\u5ea6\u76f8\u540c\uff0c\u56e0\u6b64\u5f53myisamchk \u6392\u5e8f\u5e76\u79fb\u52a8\u8bb0\u5f55\u65f6\uff0c\u53ea\u8986\u76d6\u7d22\u5f15\u4e2d\u7684\u8bb0\u5f55\u504f\u79fb\u91cf\u3002\u5982\u679c\n\u952e\u5df2\u7ecf\u6253\u5305(PACK_KEYS=1)\uff0cmyisamchk\u5fc5\u987b\u5148\u89e3\u5f00\u6253\u5305\u7684\u952e\u5757\uff0c\u7136\u540e\u91cd\u65b0\u521b\u5efa\u7d22\u5f15\u5e76\u518d\u6b21\u5c06\u952e\u5757\u6253\u5305\u3002(\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u91cd\u65b0\u521b\u5efa\u7d22\u5f15\u6bd4\u66f4\u65b0\u6bcf\u4e2a\u7d22\u5f15\u7684\u504f\u79fb\u91cf\u8981\u5feb\uff09\u3002\n<\/p>\n\n\n\n<p>4.myisamchk\u5185\u5b58\u4f7f\u7528<\/p>\n\n\n\n<p>myisamchk\u9ed8\u8ba4\u53ea\u75283M\u7684\u5185\u5b58\u6765\u4fee\u590d\uff0c\u5982\u679c\u8981\u4fee\u590d\u5927\u8868\u7684\u8bdd\uff0c\u663e\u7136\u901f\u5ea6\u4f1a\u5de8\u6162\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e3amyisamchk\u8bbe\u7f6e\u66f4\u591a\u7684\u5185\u5b58\uff0c\u6765\u4f7f\u5176\u8fd0\u884c\u7684\u66f4\u5feb\uff0c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@localhost ~]# myisamchk --sort_buffer_size=16M --key_buffer_size=16M --read_buffer_size=1M --write_buffer_size=1M\n<\/code><\/pre>\n\n\n\n<p>\u4e00\u822csort_buffer_size\u7684\u5927\u5c0f16m\u5c31\u8db3\u591f\u7528\u4e86\u3002<\/p>\n\n\n\n<p>myisamchk\u9ed8\u8ba4\u4f7f\u7528\u9009\u9879\u201c\u2013tmpdir\u201d\u4f5c\u4e3a\u4e34\u65f6\u6587\u4ef6\u7684\uff0c\u5982\u679ctmpdir\u6307\u5b9a\u5185\u5b58\u7684\u8bdd\uff0c\u6062\u590d\u7684\u8868\u6bd4\u8f83\u5927\uff0c\u5f88\u5bb9\u6613\u62a5\u5185\u5b58\u7684\u9519\u8bef\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u7528tmpdir\u6307\u5b9a\u4e00\u4e2a\u6bd4\u8f83\u5927\u7684\u6587\u4ef6\u7cfb\u7edf<\/p>\n\n\n\n<p><code>[root@localhost ~]# myisamchk --sort_buffer_size=16m --key_buffer_size=16m --read_buffer_size=2m --write_buffer_size=1m --tmpdir=\/tmp -iBfqr \/var\/lib\/mysql\/backup\/t1<\/code><\/p>\n\n\n\n<p>5.myisamchk\u7528\u4e8e\u5d29\u6e83\u6062\u590d \u5728\u4f7f\u7528myisamdchk\u4fee\u590d\u4f1a\u4f18\u5316\u8868\u65f6\uff0c\u5fc5\u987b\u4fdd\u8bc1mysqld\u670d\u52a1\u5668\u6ca1\u6709\u4f7f\u7528\u8be5\u8868\uff0c\u6700\u597d\u5173\u95edmysqld\u670d\u52a1\uff1b\u5982\u679c\u4e0d\u5173\u95edmysqld\uff0c\u5728\u8fd0\u884cmyisamchk\u4e4b\u524d\u5e94\u6267\u884cmysqladmin flash-tables\u3002\u5982\u679c\u670d\u52a1\u5668\u548cmyisamchk\u540c\u65f6\u8bbf\u95ee\u8868\uff0c\u8868\u53ef\u80fd\u4f1a\u88ab\u7834\u574f\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u201c\u2013skip-external-locking\u201d\u4e00\u822c\u662f\u7cfb\u7edf\u7684\u9ed8\u8ba4\u542f\u7528\u9009\u9879\uff0cmysql\u6570\u636e\u5e93\u4e00\u822c\u4e5f\u662f\u5e94\u7981\u7528\u8be5\u9009\u9879\uff0c\u56e0\u4e3a\u4f7f\u7528\u7cfb\u7edf\u7684lock\u548cmysql\u5f88\u5bb9\u6613\u4ea7\u751f\u6b7b\u9501\u3002<\/p>\n\n\n\n<p>\u6267\u884cmyisam\u8868\u7684\u6062\u590d\u53ea\u8981\u662f\u4fee\u590d\u8868\u7684\u4e09\u4e2a\u6587\u4ef6\uff0c\u6700\u5e38\u53d1\u751f\u95ee\u9898\u7684\u6587\u4ef6\u662f\u6570\u636e\u6587\u4ef6\u548c\u7d22\u5f15\u6587\u4ef6 tbl_name.frm\uff1a\u5b9a\u4e49(\u683c\u5f0f)\u6587\u4ef6 tbl_name.MYD\uff1a\u6570\u636e\u6587\u4ef6 tbl_name.MYI\uff1a\u7d22\u5f15\u6587\u4ef6<\/p>\n\n\n\n<p>\u6062\u590d\u6b65\u9aa4 A.\u68c0\u67e5myisam\u8868\u7684\u9519\u8bef&nbsp;<code>myisamchk -im --verbose \/var\/lib\/mysql\/backup\/t1<\/code><\/p>\n\n\n\n<p>\u5982\u679c\u6709\u9519\u8bef\uff0c\u7528perror\u547d\u4ee4\u67e5\u770b\u9519\u8bef\u7801 [root@localhost ~]# perror 126 OS error code 126: Required key not available<\/p>\n\n\n\n<p>B.\u521d\u7ea7\u4fee\u590dmyisam\u8868 \u8bd5\u56fe\u4e0d\u63a5\u89e6\u6570\u636e\u6587\u4ef6\u6765\u4fee\u590d\u7d22\u5f15\u6587\u4ef6\uff0c&nbsp;<code>myisamchk -rq tablename<\/code><\/p>\n\n\n\n<p>\u5982\u679c\u6062\u590d\u5931\u8d25\uff0c\u7ee7\u7eed\u5982\u4e0b #[root@localhost ~]# myisamchk -Br tablename<\/p>\n\n\n\n<p>\u8fd8\u4e0d\u884c\u5c31\u6267\u884c\u5982\u4e0b #[root@localhost ~]# myisamchk -o tablename<\/p>\n\n\n\n<p>C.\u4e2d\u7ea7\u4fee\u590dmyisam\u8868 \u53ea\u6709\u5728\u7d22\u5f15\u6587\u4ef6\u7684\u7b2c\u4e00\u4e2a16K\u5757\u88ab\u7834\u574f\uff0c\u6216\u5305\u542b\u4e0d\u6b63\u786e\u7684\u4fe1\u606f\uff0c\u6216\u5982\u679c\u7d22\u5f15\u6587\u4ef6\u4e22\u5931\uff0c\u4f60\u624d\u5e94\u8be5\u5230\u8fd9\u4e2a\u9636\u6bb5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1).\u628a\u6570\u636e\u6587\u4ef6\u79fb\u5230\u5b89\u5168\u7684\u5730\u65b9\u3002\n2).\u4f7f\u7528\u8868\u63cf\u8ff0\u6587\u4ef6\u521b\u5efa\u65b0\u7684(\u7a7a)\u6570\u636e\u6587\u4ef6\u548c\u7d22\u5f15\u6587\u4ef6\uff1a\n3).shell> mysql db_name\n4).mysql> SET AUTOCOMMIT=1;\n5).mysql> TRUNCATE TABLE tbl_name;\n6).mysql> quit\n<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709TRUNCATE TABLE\uff0c\u5219\u4f7f\u7528DELETE FROM tbl_name\u3002 7).\u5c06\u8001\u7684\u6570\u636e\u6587\u4ef6\u62f7\u8d1d\u5230\u65b0\u521b\u5efa\u7684\u6570\u636e\u6587\u4ef6\u4e4b\u4e2d\u3002 (\u8bb0\u5f97\u4fdd\u7559\u4e00\u4e2a\u526f\u672c\u4ee5\u9632\u67d0\u4e9b\u4e1c\u897f\u51fa\u9519) 8).\u5728\u5b9e\u884cmyisamchk -rq tablename\u5e94\u8be5\u5c31\u53ef\u4ee5\u4e86 \u6216&nbsp;<code>mysql&gt; REPAIR TABLE tbl_name USE_FRM<\/code><\/p>\n\n\n\n<p>D.\u9ad8\u7ea7\u6062\u590d 1).\u4ece\u4e00\u4e2a\u5907\u4efd\u6062\u590d\u63cf\u8ff0\u6587\u4ef6\u7136\u540e\u6267\u884c\u201cmyisamchk -r tablename\u201d 2).\u5982\u679c\u6ca1\u6709\u5907\u4efd\u800c\u77e5\u9053\u8868\u662f\u600e\u6837\u521b\u5efa\u7684\uff0c\u5728\u53e6\u4e00\u4e2a\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u8868\u7684\u4e00\u4e2a\u62f7\u8d1d\u3002\u5220\u9664\u65b0\u7684\u6570\u636e\u6587\u4ef6\uff0c\u7136\u540e\u4ece\u5176\u4ed6\u6570\u636e\u5e93\u5c06\u63cf\u8ff0\u6587\u4ef6\u548c\u7d22\u5f15\u6587\u4ef6\u79fb\u5230\u7834\u574f\u7684\u6570\u636e\u5e93\u4e2d\u3002\u8fd9\u6837\u5728\u7834\u574f\u7684\u5e93\u91cc\u5c31\u6709\u65b0\u7684\u63cf\u8ff0\u548c\u7d22\u5f15\u6587\u4ef6\uff0c\u4f46\u662f\u8ba9.MYD\u6570\u636e\u6587\u4ef6\u72ec\u81ea\u7559\u4e0b\u6765\u4e86\u3002\u7136\u540e\u5728\u6267\u884c\u201cmyisamchk -r tablename\u201d<\/p>\n\n\n\n<p>6.myisamchk\u5bf9\u8868\u4f18\u5316 \u4e3a\u4e86\u7ec4\u5408\u788e\u7247\u8bb0\u5f55\u5e76\u4e14\u6d88\u9664\u7531\u4e8e\u5220\u9664\u6216\u66f4\u65b0\u8bb0\u5f55\u800c\u6d6a\u8d39\u7684\u7a7a\u95f4&nbsp;<code>shell&gt; myisamchk -r tbl_name<\/code><\/p>\n\n\n\n<p>\u5bf9\u6240\u6709\u7684\u7d22\u5f15\u8fdb\u884c\u6392\u5e8f\u4ee5\u4fbf\u66f4\u5feb\u5730\u67e5\u627e\u952e\u503c&nbsp;<code>myisamch -S tablename<\/code><\/p>\n\n\n\n<p>\u5bf9\u6307\u5b9a\u7684\u7d22\u5f15\u8fdb\u884c\u6392\u5e8f\u4ee5\u4fbf\u66f4\u5feb\u5730\u67e5\u627e\u952e\u503c&nbsp;<code>mysql&gt; show index from tablename;<\/code>&nbsp;<code>myisamch -R 1 tablename<\/code><\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u7528\u52a8\u6001\u5927\u5c0f\u7684\u884c\u66f4\u6539MyISAM\u8868(\u542bVARCHAR\u3001BLOB\u6216TEXT\u5217\u7684\u8868)\u6216\u6709\u5220\u9664\u4e86\u8bb8\u591a\u884c\u7684\u8868\uff0c\u4f60\u53ef\u80fd\u60f3\u8981\u4e0d\u65f6\u5730\uff08\u6bcf\u6708\u4e00\u6b21\uff09\u6574\u7406\/\u7ec4\u5408\u8868\u7684\u7a7a\u95f4<\/p>\n\n\n\n<p>\u53ef\u4ee5\u5bf9\u6709\u95ee\u9898\u7684\u8868\u6267\u884cOPTIMIZE TABLE\u6765\u4f18\u5316\u3002\u6216\u8005\u662f\uff0c\u5982\u679c\u53ef\u4ee5\u505c\u4e00\u4f1amysqld\u670d\u52a1\u5668,\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a&nbsp;<code>myisamchk -r -s --sort-index -O sort_buffer_size=16M *\/*.MYI<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<ul><li><a href=\"https:\/\/loni.xyz\/2018\/01\/29\/Pyspider-Installation-Tutorial\/\">PREVIOUS<br>PYTON \u5b89\u88c5<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u767b\u5f55liunx\u670d\u52a1\u5668 2\u3001cd \/home\/MysqlData\/\u6570\u636e\u5e93\u540d 3\u3001myisamchk -c -&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"http:\/\/43.139.139.10\/wordpress\/31\/\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[8],"tags":[4],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pbrrw3-v","_links":{"self":[{"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/posts\/31"}],"collection":[{"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":2,"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":33,"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/posts\/31\/revisions\/33"}],"wp:attachment":[{"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/43.139.139.10\/wordpress\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}