{"id":2454,"date":"2014-06-23T15:06:31","date_gmt":"2014-06-23T07:06:31","guid":{"rendered":"http:\/\/kuki.idv.tw\/?p=2454"},"modified":"2014-06-23T15:06:31","modified_gmt":"2014-06-23T07:06:31","slug":"%e4%bf%ae%e5%be%a9%e8%b3%87%e6%96%99%e5%ba%ab%e6%8c%87%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/www.kuki.idv.tw\/?p=2454","title":{"rendered":"\u4fee\u5fa9\u8cc7\u6599\u5eab\u6307\u4ee4"},"content":{"rendered":"<p><span style=\"color: #000000;\">\u5feb\u901f\u4fee\u5fa9\u8cc7\u6599\u5eab\u7684\u65b9\u6cd5\uff01<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u6709\u7684\u6642\u5019\u56e0\u70ba\u6389\u96fb\u6216\u8005\u5176\u4ed6\u539f\u56e0\u5c0e\u81f4\u8cc7\u6599\u5eab\u640d\u58de,\u6211\u5011\u53ef\u4ee5\u4f7f\u7528mysql\u81ea\u5e36\u7684mysqlcheck\u547d\u4ee4\u4f86\u5feb\u901f\u4fee\u5fa9\u6240\u6709\u7684\u8cc7\u6599\u5eab\u6216\u8005\u7279\u5b9a\u7684\u8cc7\u6599\u5eab;\u4f8b\u5982\u00a0<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u6aa2\u67e5\u512a\u5316\u4e26\u4fee\u5fa9\u6240\u6709\u7684\u8cc7\u6599\u5eab\u7528:\u00a0<\/span><br style=\"color: #cccccc;\" \/><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\"># mysqlcheck -A -o -r -p\u00a0<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">Enter password:\u00a0<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">database1 OK<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">database2 OK<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">&#8212;&#8212;&#8212;-<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u4fee\u5fa9\u6307\u5b9a\u7684\u8cc7\u6599\u5eab\u7528\u00a0<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\"># mysqlcheck -A -o -r Database_NAME -p\u00a0<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u5373\u53ef<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u53e6\u5916\u5982\u679c\u53ea\u662f\u5c0d\u67d0\u500b\u8868\u9032\u884c\u4fee\u5fa9\u53ef\u4ee5\u7528\uff1amyisamchk\u6216isamchk<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u5176\u4e2dmyisamchk\u9069\u7528\u65bcMYISAM\u985e\u578b\u7684\u8cc7\u6599\u8868\uff0c\u800cisamchk\u9069\u7528\u65bcISAM\u985e\u578b\u7684\u8cc7\u6599\u8868\u3002\u9019\u5169\u689d\u547d\u4ee4\u7684\u4e3b\u8981\u53c3\u6578\u76f8\u540c\uff0c\u4e00\u822c\u65b0\u7684\u7cfb\u7d71\u90fd\u4f7f\u7528MYISAM\u4f5c\u70ba\u7f3a\u7701\u7684\u8cc7\u6599\u8868\u985e\u578b\uff0c\u9019\u88cf\u4ee5myisamchk\u70ba\u4f8b\u5b50\u9032\u884c\u8aaa\u660e\u3002\u7576\u767c\u73fe\u67d0\u500b\u8cc7\u6599\u8868\u51fa\u73fe\u554f\u984c\u6642\u53ef\u4ee5\u4f7f\u7528\uff1a<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">myisamchk tablename.MYI<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u9032\u884c\u6aa2\u6e2c\uff0c\u5982\u679c\u9700\u8981\u4fee\u5fa9\u7684\u8a71\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">myisamchk -of tablename.MYI<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u95dc\u65bcmyisamchk\u7684\u8a73\u7d30\u53c3\u6578\u8aaa\u660e\uff0c\u53ef\u4ee5\u53c3\u898b\u5b83\u7684\u4f7f\u7528\u5e6b\u52a9\u3002\u9700\u8981\u6ce8\u610f\u7684\u6642\u5728\u9032\u884c\u4fee\u6539\u6642\u5fc5\u9808\u78ba\u4fddMySQL\u4f3a\u670d\u5668\u6c92\u6709\u8a2a\u554f\u9019\u500b\u8cc7\u6599\u8868\uff0c\u4fdd\u96aa\u7684\u60c5\u6cc1\u4e0b\u662f\u6700\u597d\u5728\u9032\u884c\u6aa2\u6e2c\u6642\u628aMySQL\u4f3a\u670d\u5668Shutdown\u6389\u3002<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u53e6\u5916\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u547d\u4ee4\u653e\u5728\u4f60\u7684rc.local\u88cf\u9762\u555f\u52d5MySQL\u4f3a\u670d\u5668\u524d\uff1a<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">[ -x \/tmp\/mysql.sock ] &amp;&amp; \/pathtochk\/myisamchk -of \/DATA_DIR\/*\/*.MYI<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u5176\u4e2d\u7684\/tmp\/mysql.sock\u662fMySQL\u76e3\u807d\u7684Sock\u6a94\u4f4d\u7f6e\uff0c\u5c0d\u65bc\u4f7f\u7528RPM\u5b89\u88dd\u7684\u7528\u6236\u61c9\u8a72\u662f\/var\/lib\/mysql\/mysql.sock\uff0c\u5c0d\u65bc\u4f7f\u7528\u6e90\u78bc\u5b89\u88dd\u5247\u662f\/tmp\/mysql.sock\u53ef\u4ee5\u6839\u64da\u81ea\u5df1\u7684\u5be6\u969b\u60c5\u6cc1\u9032\u884c\u8b8a\u66f4\uff0c\u800cpathtochk\u5247\u662fmyisamchk\u6240\u5728\u7684\u4f4d\u7f6e\uff0cDATA_DIR\u662f\u4f60\u7684MySQL\u8cc7\u6599\u5eab\u5b58\u653e\u7684\u4f4d\u7f6e\u3002<\/span><br style=\"color: #cccccc;\" \/><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u6700\u4f73\u5316\u8cc7\u6599\u8868<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">OPTIMIZE TABLE `\u8868\u540d`,`\u8868\u540d`,&#8230;..;<\/span><br style=\"color: #cccccc;\" \/><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u7576\u6211\u5011\u6309\u7167\u539f\u4f86\u7684\u65b9\u5f0f\u901a\u904ePHP\u5b58\u53d6MySQL\u8cc7\u6599\u5eab\u6642\uff0c\u5c31\u7b97\u8a2d\u7f6e\u4e86\u8868\u7684\u9ed8\u8a8d\u5b57\u5143\u96c6\u70bautf8\u4e26\u4e14\u901a\u904eUTF-8\u7de8\u78bc\u767c\u9001\u67e5\u8a62\uff0c\u4f60\u6703\u767c\u73fe\u5b58\u5165\u8cc7\u6599\u5eab\u7684\u4ecd\u7136\u662f\u4e82\u78bc\u3002\u554f\u984c\u5c31\u51fa\u5728\u9019\u500bconnection\u9023\u63a5\u5c64\u4e0a\u3002\u89e3\u6c7a\u65b9\u6cd5\u662f\u5728\u767c\u9001\u67e5\u8a62\u524d\u57f7\u884c\u4e00\u4e0b\u4e0b\u9762\u9019\u53e5\uff1a<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">SET NAMES \u2018utf8\u2019;<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u4e0d\u904e\u6700\u597d\u7684\u65b9\u6cd5\u9084\u662f\u5728 my.cnf \u4e2d\u7684 [client] \u548c [mysqld] \u7ae0\u7bc0\u4e2d\u90fd\u52a0\u4e0a\u4e00\u884c default-character-set=utf8<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">\u5c31\u53ef\u4ee5\u4e86:\u00a0<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">[client]<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">default-character-set=utf8<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">[mysqld]<\/span><br style=\"color: #cccccc;\" \/><span style=\"color: #000000;\">default-character-set=utf8<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5feb\u901f\u4fee\u5fa9\u8cc7\u6599\u5eab\u7684\u65b9\u6cd5\uff01\u6709\u7684\u6642\u5019\u56e0\u70ba\u6389\u96fb\u6216\u8005\u5176\u4ed6\u539f\u56e0\u5c0e\u81f4\u8cc7\u6599\u5eab\u640d\u58de,\u6211\u5011\u53ef\u4ee5\u4f7f\u7528mysql\u81ea\u5e36\u7684mysqlche &hellip; <a href=\"https:\/\/www.kuki.idv.tw\/?p=2454\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u4fee\u5fa9\u8cc7\u6599\u5eab\u6307\u4ee4\u3009<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2454"}],"collection":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2454"}],"version-history":[{"count":1,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2454\/revisions"}],"predecessor-version":[{"id":2455,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2454\/revisions\/2455"}],"wp:attachment":[{"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kuki.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}