8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

7.9.1 调试 MySQL 服务器7.9.1 Debugging a MySQL Server

如果你正在使用 MySQL 中非常新的某些功能,可以尝试使用 mysqld 并加上 --skip-new 选项(该选项会禁用所有新功能,可能不安全)。请参见 B.3.3.3 节,“如果 MySQL 不断崩溃该怎么办”。If you are using some functionality that is very new in MySQL, you can try to run mysqld with the --skip-new option (which disables all new, potentially unsafe functionality). See Section B.3.3.3, “What to Do If MySQL Keeps Crashing”.

如果 mysqld 无法启动,请确认没有任何 my.cnf 文件干扰您的设置!您可以使用 mysqld --print-defaults 检查 my.cnf 参数,并通过使用 mysqld --no-defaults ... 来避免使用它们。If mysqld does not want to start, verify that you have no my.cnf files that interfere with your setup! You can check your my.cnf arguments with mysqld --print-defaults and avoid using them by starting with mysqld --no-defaults ....

如果 mysqld 开始占用大量 CPU 或内存,或者如果它 “挂起,” 你可以使用 mysqladmin processlist status 来查出是否有人正在执行耗时的查询。如果你遇到性能问题或新客户端无法连接的问题,可能需要在某个窗口中运行 mysqladmin -i10 processlist status。If mysqld starts to eat up CPU or memory or if it “hangs,” you can use mysqladmin processlist status to find out if someone is executing a query that takes a long time. It may be a good idea to run mysqladmin -i10 processlist status in some window if you are experiencing performance problems or problems when new clients cannot connect.

命令 mysqladmin debug 会将一些关于正在使用的锁、使用的内存和查询使用情况的信息转储到 MySQL 日志文件中。这可能有助于解决一些问题。即使你没有为调试编译 MySQL,该命令也提供了一些有用的信息!The command mysqladmin debug dumps some information about locks in use, used memory and query usage to the MySQL log file. This may help solve some problems. This command also provides some useful information even if you have not compiled MySQL for debugging!

如果问题是某些表变得越来越慢,您应该尝试使用OPTIMIZE TABLE或myisamchk来优化表。请参阅第 7 章,MySQL 服务器管理。您还应该使用EXPLAIN检查慢查询。If the problem is that some tables are getting slower and slower you should try to optimize the table with OPTIMIZE TABLE or myisamchk. See Chapter 7, MySQL Server Administration. You should also check the slow queries with EXPLAIN.

您还应阅读本手册中针对操作系统的特定章节,以了解可能仅在您的环境中出现的问题。参见 第 2.1 节,“通用安装指南”。You should also read the OS-specific section in this manual for problems that may be unique to your environment. See Section 2.1, “General Installation Guidance”.