8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 9 备份与恢复 / 9.6 MyISAM 表维护和崩溃恢复
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

9.6 MyISAM 表维护与崩溃恢复9.6 MyISAM Table Maintenance and Crash Recovery

本节讨论如何使用 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:

有关这些语句的更多信息,请参见 第 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.