文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 17 InnoDB 存储引擎 / 17.20 InnoDB 故障排除
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

17.20 InnoDB 故障排除17.20 InnoDB Troubleshooting

以下通用指南适用于排查 InnoDB 的问题:The following general guidelines apply to troubleshooting InnoDB problems:

  • 当操作失败或您怀疑存在错误时,请查看 MySQL 服务器错误日志(参见 第 7.4.2 节,“错误日志”)。服务器错误信息参考 提供了一些常见 InnoDB 特定错误的故障排除信息。When an operation fails or you suspect a bug, look at the MySQL server error log (see Section 7.4.2, “The Error Log”). Server Error Message Reference provides troubleshooting information for some of the common InnoDB-specific errors that you may encounter.

  • 如果故障与死锁有关,请启用innodb_print_all_deadlocks选项运行,以便将每个死锁的详细信息打印到 MySQL 服务器错误日志中。有关死锁的信息,请参阅第 17.7.5 节,“InnoDB 中的死锁”。If the failure is related to a deadlock, run with the innodb_print_all_deadlocks option enabled so that details about each deadlock are printed to the MySQL server error log. For information about deadlocks, see Section 17.7.5, “Deadlocks in InnoDB”.

  • 如果问题与InnoDB 数据字典有关,请参阅第 17.20.4 节,“排查 InnoDB 数据字典操作问题”。If the issue is related to the InnoDB data dictionary, see Section 17.20.4, “Troubleshooting InnoDB Data Dictionary Operations”.

  • 在进行故障排除时,通常最好从命令提示符运行 MySQL 服务器,而不是通过 mysqld_safe 或作为 Windows 服务运行。这样,你就可以看到 mysqld 在控制台上输出的内容,从而更好地了解发生了什么。在 Windows 上,可以使用 mysqld 并加上 --console 选项来将输出定向到控制台窗口。When troubleshooting, it is usually best to run the MySQL server from the command prompt, rather than through mysqld_safe or as a Windows service. You can then see what mysqld prints to the console, and so have a better grasp of what is going on. On Windows, start mysqld with the --console option to direct the output to the console window.

  • 启用 InnoDB 监视器以获取问题信息(参见 第 17.17 节,“InnoDB 监视器”)。如果问题与性能相关,或者您的服务器似乎挂起,您应该启用标准监视器以打印 InnoDB 的内部状态信息。如果问题与锁相关,请启用锁监视器。如果问题与表创建、表空间或数据字典操作相关,请参考 InnoDB 信息架构系统表 检查 InnoDB 内部数据字典的内容。 Enable the InnoDB Monitors to obtain information about a problem (see Section 17.17, “InnoDB Monitors”). If the problem is performance-related, or your server appears to be hung, you should enable the standard Monitor to print information about the internal state of InnoDB. If the problem is with locks, enable the Lock Monitor. If the problem is with table creation, tablespaces, or data dictionary operations, refer to the InnoDB Information Schema system tables to examine contents of the InnoDB internal data dictionary.

    InnoDB 会在以下情况下临时启用标准 InnoDB 监控输出:InnoDB temporarily enables standard InnoDB Monitor output under the following conditions:

    • 长时间的信号量等待A long semaphore wait

    • InnoDB 在缓冲池中找不到空闲块InnoDB cannot find free blocks in the buffer pool

    • 缓冲池中超过 67% 的空间被锁堆或自适应哈希索引占用Over 67% of the buffer pool is occupied by lock heaps or the adaptive hash index

  • 如果怀疑某个表已损坏,请对该表运行 CHECK TABLE。If you suspect that a table is corrupt, run CHECK TABLE on that table.