Here is a simple command to auto repair, check and optimize all the tables in all databases running on a MySQL server :這裡是一個簡單的命令,以汽車修理,檢查和優化所有表格在所有數據庫上運行的MySQL服務器

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases mysqlcheck中美根- P的-自動修復-檢查-優化-所有數據庫

mysqlcheck is available in MySQL 3.23.38 and later. mysqlcheck可在MySQL 3.23.38和更高版本。

mysqlcheck uses the SQL statements CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE in a convenient way for the user. mysqlcheck使用SQL語句檢查表,維修表,分析表,優化表在一個便捷的途徑用戶。 It determines which statements to use for the operation you want to perform, and then sends the statements to the server to be executed.它決定了報表,其中用於操作,您要執行,然後發送報表到服務器被處決。 The exact operations are determined by the underlying storage engine used.確切的行動是由潛在的存儲引擎使用。

You must execute it on running database.您必須執行它的運行數據庫。 It is recommended that you kill other incoming queries (like from your website) before running this which makes it a lot faster.它是建議你殺其他傳入的查詢(如從您的網站)之前運行,這使得它有很多的更快。 I simply stop my httpd server before running it.我只是停止我的httpd服務器,然後運行它。 You may want to use a您可能會想要使用 Site Unavailable網站無法使用 message instead so that the MySQL server is left alone.訊息,而不是使MySQL服務器是單獨留在家中。