当您遇到问题时,首先要做的是找出是哪个程序或设备导致的问题:When you run into a problem, the first thing you should do is to find out which program or piece of equipment is causing it:
如果您有以下症状之一,那么它很可能是硬件问题(如内存、主板、CPU 或硬盘)或内核问题:If you have one of the following symptoms, then it is probably a hardware problems (such as memory, motherboard, CPU, or hard disk) or kernel problem:
键盘无法工作。通常可以通过按 Caps Lock 键来检查。如果 Caps Lock 灯没有变化,您需要更换键盘。(在此之前,您应尝试重启计算机并检查所有键盘连接线。)The keyboard does not work. This can normally be checked by pressing the Caps Lock key. If the Caps Lock light does not change, you have to replace your keyboard. (Before doing this, you should try to restart your computer and check all cables to the keyboard.)
鼠标指针无法移动。The mouse pointer does not move.
该机器无法响应该远程机器的 ping 请求。The machine does not answer to a remote machine's pings.
与 MySQL 无关的其他程序运行不正常。Other programs that are not related to MySQL do not behave correctly.
您的系统意外重启了。(一个有缺陷的用户级程序绝不应能够导致系统崩溃。)Your system restarted unexpectedly. (A faulty user-level program should never be able to take down your system.)
在这种情况下,您应首先检查所有电缆,并运行一些诊断工具来检查您的硬件!您还应检查操作系统是否有任何可能解决问题的补丁、更新或服务包。同时确保所有库(例如
glibc)都是最新的。In this case, you should start by checking all your cables and run some diagnostic tool to check your hardware! You should also check whether there are any patches, updates, or service packs for your operating system that could likely solve your problem. Check also that all your libraries (such asglibc) are up to date.使用带 ECC 内存的机器总是有益的,可以及早发现内存问题。It is always good to use a machine with ECC memory to discover memory problems early.
如果您的键盘被锁定,您可以尝试通过另一台机器登录并执行
kbd_mode -a来恢复。If your keyboard is locked up, you may be able to recover by logging in to your machine from another machine and executingkbd_mode -a.请检查您的系统日志文件(
/var/log/messages或类似文件)以查找问题原因。如果您认为问题出在 MySQL 上,也应检查 MySQL 的日志文件。请参阅 第 7.4 节,“MySQL 服务器日志”。Please examine your system log file (/var/log/messagesor similar) for reasons for your problem. If you think the problem is in MySQL, you should also examine MySQL's log files. See Section 7.4, “MySQL Server Logs”.如果您认为硬件没有问题,您应该尝试找出哪个程序导致了问题。尝试使用 top、ps、任务管理器或类似程序,检查哪个程序占用了全部 CPU 或锁定了计算机。If you do not think you have hardware problems, you should try to find out which program is causing problems. Try using top, ps, Task Manager, or some similar program, to check which program is taking all CPU or is locking the machine.
使用 top、df 或类似程序检查是否内存不足、磁盘空间不足、文件描述符不足或其他关键资源不足。Use top, df, or a similar program to check whether you are out of memory, disk space, file descriptors, or some other critical resource.
如果问题是某个失控的进程,你总是可以尝试杀掉它。如果它不想被终止,那么操作系统很可能存在一个错误。If the problem is some runaway process, you can always try to kill it. If it does not want to die, there is probably a bug in the operating system.
如果你已经检查了所有其他可能性,并得出结论认为是 MySQL 服务器或 MySQL 客户端导致了问题,那就该创建一个错误报告了,见 第 1.6 节,“如何报告错误或问题”。在错误报告中,尽量给出系统行为的完整描述以及你认为发生了什么情况。同时说明你为什么认为 MySQL 导致了问题。考虑本章描述的所有情况。准确说明在检查系统时出现的任何问题。对于程序和日志文件中的任何输出和错误信息,请使用 “复制和粘贴” 方法。If you have examined all other possibilities and concluded that the MySQL server or a MySQL client is causing the problem, it is time to create a bug report, see Section 1.6, “How to Report Bugs or Problems”. In the bug report, try to give a complete description of how the system is behaving and what you think is happening. Also state why you think that MySQL is causing the problem. Take into consideration all the situations described in this chapter. State any problems exactly how they appear when you examine your system. Use the “copy and paste” method for any output and error messages from programs and log files.
尝试详细描述哪个程序无法正常工作以及你看到的所有症状。我们过去收到过许多错误报告,仅仅说明“系统无法工作。” 这没有提供任何有关可能问题的信息。Try to describe in detail which program is not working and all symptoms you see. We have in the past received many bug reports that state only “the system does not work.” This provides us with no information about what could be the problem.
如果某个程序失败,了解以下信息总是有用的:If a program fails, it is always useful to know the following information:
相关程序是否发生了分段错误(是否产生了核心转储)?Has the program in question made a segmentation fault (did it dump core)?
该程序是否占用所有可用的 CPU 时间?使用top检查。让程序运行一段时间,它可能只是正在进行计算密集型的操作。Is the program taking up all available CPU time? Check with top. Let the program run for a while, it may simply be evaluating something computationally intensive.
如果 mysqld 服务器出现问题,你能通过 mysqladmin -u root ping 或 mysqladmin -u root processlist 得到任何响应吗?If the mysqld server is causing problems, can you get any response from it with mysqladmin -u root ping or mysqladmin -u root processlist?
当你尝试连接到 MySQL 服务器时,客户端程序会显示什么?(例如,尝试使用 mysql。)客户端会卡住吗?你能从程序中得到任何输出吗?What does a client program say when you try to connect to the MySQL server? (Try with mysql, for example.) Does the client jam? Do you get any output from the program?
在发送错误报告时,你应该遵循第 1.6 节,“如何报告错误或问题”中描述的提纲。When sending a bug report, you should follow the outline described in Section 1.6, “How to Report Bugs or Problems”.