- 9.6.1 使用 myisamchk 进行崩溃恢复9.6.1 Using myisamchk for Crash Recovery
- 9.6.2 如何检查 MyISAM 表的错误9.6.2 How to Check MyISAM Tables for Errors
- 9.6.3 如何修复 MyISAM 表9.6.3 How to Repair MyISAM Tables
- 9.6.4 MyISAM 表优化9.6.4 MyISAM Table Optimization
- 9.6.5 设置 MyISAM 表维护计划9.6.5 Setting Up a MyISAM Table Maintenance Schedule
本节讨论如何使用 myisamchk 来检查或修复 MyISAM 表(使用 .MYD 和 .MYI 文件存储数据和索引的表)。有关一般的 myisamchk 背景,请参见 第 6.6.4 节,“myisamchk — MyISAM 表维护工具”。其他表修复信息可以在 第 3.14 节,“重建或修复表或索引” 中找到。This section discusses how to use myisamchk to
check or repair MyISAM tables (tables that have
.MYD and .MYI files for
storing data and indexes). For general
myisamchk background, see
Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”. Other table-repair information can be
found at Section 3.14, “Rebuilding or Repairing Tables or Indexes”.
您可以使用 myisamchk 来检查、修复或优化表。以下各节介绍了如何执行这些操作以及如何设置表维护计划。有关使用 myisamchk 获取表信息的说明,请参阅 第 6.6.4.5 节,“使用 myisamchk 获取表信息”。You can use myisamchk to check, repair, or optimize database tables. The following sections describe how to perform these operations and how to set up a table maintenance schedule. For information about using myisamchk to get information about your tables, see Section 6.6.4.5, “Obtaining Table Information with myisamchk”.
尽管使用 myisamchk 修复表是相当安全的,但在进行修复或任何可能对表进行大量更改的维护操作之前,始终备份 是一个好主意。Even though table repair with myisamchk is quite secure, it is always a good idea to make a backup before doing a repair or any maintenance operation that could make a lot of changes to a table.
影响索引的 myisamchk 操作可能导致 MyISAM FULLTEXT 索引使用与 MySQL 服务器使用的值不兼容的全文参数重建。为避免此问题,请遵循 第 6.6.4.1 节,“myisamchk 通用选项” 中的指南。myisamchk operations that affect indexes can
cause MyISAM FULLTEXT
indexes to be rebuilt with full-text parameters that are
incompatible with the values used by the MySQL server. To avoid
this problem, follow the guidelines in
Section 6.6.4.1, “myisamchk General Options”.
MyISAM 表的维护也可以使用 SQL 语句来完成,这些操作与 myisamchk 所能执行的操作类似:MyISAM table maintenance can also be done using
the SQL statements that perform operations similar to what
myisamchk can do:
要检查
MyISAM表,请使用CHECK TABLE。To checkMyISAMtables, useCHECK TABLE.要修复
MyISAM表,请使用REPAIR TABLE。To repairMyISAMtables, useREPAIR TABLE.要优化
MyISAM表,请使用OPTIMIZE TABLE。To optimizeMyISAMtables, useOPTIMIZE TABLE.要分析
MyISAM表,请使用ANALYZE TABLE。To analyzeMyISAMtables, useANALYZE TABLE.
有关这些语句的更多信息,请参见 第 15.7.3 节,“表维护语句”。For additional information about these statements, see Section 15.7.3, “Table Maintenance Statements”.
这些语句可以直接使用,也可以通过mysqlcheck客户端程序使用。这些语句相比myisamchk的一个优点是服务器完成所有工作。使用myisamchk时,你必须确保服务器不会同时使用这些表,以避免myisamchk与服务器之间发生不希望的交互。These statements can be used directly or by means of the mysqlcheck client program. One advantage of these statements over myisamchk is that the server does all the work. With myisamchk, you must make sure that the server does not use the tables at the same time so that there is no unwanted interaction between myisamchk and the server.