在发布有关问题的错误报告之前,请尝试验证它是否是一个错误并且尚未报告:Before posting a bug report about a problem, please try to verify that it is a bug and that it has not been reported already:
首先在 https://dev.mysql.com/doc/。我们通过经常更新新发现问题的解决方案来努力使手册保持最新状态。此外,手册附带的发行说明可能特别有用,因为较新的版本很可能包含您问题的解决方案。发行说明可在手册中给出的位置找到。Start by searching the MySQL online manual at https://dev.mysql.com/doc/. We try to keep the manual up to date by updating it frequently with solutions to newly found problems. In addition, the release notes accompanying the manual can be particularly useful since it is quite possible that a newer version contains a solution to your problem. The release notes are available at the location just given for the manual.
如果您收到 SQL 语句的解析错误,请仔细检查您的语法。如果您找不到问题,则很可能您当前版本的 MySQL Server 不支持您正在使用的语法。如果您使用的是当前版本,并且手册未涵盖您正在使用的语法,则 MySQL Server 不支持您的语句。If you get a parse error for an SQL statement, please check your syntax closely. If you cannot find something wrong with it, it is extremely likely that your current version of MySQL Server doesn't support the syntax you are using. If you are using the current version and the manual doesn't cover the syntax that you are using, MySQL Server doesn't support your statement.
如果手册涵盖了您正在使用的语法,但您拥有较旧版本的 MySQL Server,则应检查 MySQL 更改历史记录以了解该语法何时实施。在这种情况下,您可以选择升级到较新版本的 MySQL Server。If the manual covers the syntax you are using, but you have an older version of MySQL Server, you should check the MySQL change history to see when the syntax was implemented. In this case, you have the option of upgrading to a newer version of MySQL Server.
有关一些常见问题的解决方案,请参阅第 B.3 节“问题和常见错误”。For solutions to some common problems, see Section B.3, “Problems and Common Errors”.
在 http://bugs.mysql.com/ 查看错误是否已报告并修复。Search the bugs database at http://bugs.mysql.com/ to see whether the bug has been reported and fixed.
您还可以使用http://www.mysql.com/search/ 搜索位于 MySQL 网站的所有网页(包括手册)。You can also use http://www.mysql.com/search/ to search all the Web pages (including the manual) that are located at the MySQL website.
如果您在手册、错误数据库或邮件列表档案中找不到答案,请咨询您当地的 MySQL 专家。如果您仍然找不到问题的答案,请使用以下指南来报告错误。If you cannot find an answer in the manual, the bugs database, or the mailing list archives, check with your local MySQL expert. If you still cannot find an answer to your question, please use the following guidelines for reporting the bug.
报告错误的正常方法是访问 http://bugs.mysql.com/,这是我们错误数据库的地址。该数据库是公开的,任何人都可以浏览和搜索。如果您登录到系统,则可以输入新的报告。The normal way to report bugs is to visit http://bugs.mysql.com/, which is the address for our bugs database. This database is public and can be browsed and searched by anyone. If you log in to the system, you can enter new reports.
在 http://bugs.mysql.com/ 的错误数据库中发布的针对给定版本更正的错误会在发行说明中注明。Bugs posted in the bugs database at http://bugs.mysql.com/ that are corrected for a given release are noted in the release notes.
如果您在 MySQL Server 中发现安全错误,请立即发送电子邮件至 <secalert_us@oracle.com>。例外:支持客户应通过 http://support.oracle.com/ 向 Oracle 支持报告所有问题,包括安全错误。If you find a security bug in MySQL Server, please let us know
immediately by sending an email message to
<secalert_us@oracle.com>. Exception: Support customers
should report all problems, including security bugs, to Oracle
Support at http://support.oracle.com/.
要与其他用户讨论问题,您可以使用 MySQL 社区 Slack.To discuss problems with other users, you can use the MySQL Community Slack.
编写一份好的错误报告需要耐心,但第一次就把它做好可以为我们和您自己节省时间。一份好的错误报告,包含该错误的完整测试用例,使我们很有可能在下一个版本中修复该错误。本节帮助您正确撰写报告,以便您不会浪费时间做对我们没有多大帮助或根本没有帮助的事情。请仔细阅读本节,并确保您的报告中包含此处描述的所有信息。Writing a good bug report takes patience, but doing it right the first time saves time both for us and for yourself. A good bug report, containing a full test case for the bug, makes it very likely that we will fix the bug in the next release. This section helps you write your report correctly so that you do not waste your time doing things that may not help us much or at all. Please read this section carefully and make sure that all the information described here is included in your report.
您最好在发布之前使用 MySQL Server 的最新生产或开发版本来测试问题。任何人都应该能够通过在测试用例上使用 mysql test <
script_file 或运行您在错误报告中包含的 shell 或 Perl 脚本来重复该错误。我们能够重复的任何错误都有很高的机会在下一个 MySQL 版本中得到修复。Preferably, you should test the problem using the latest production
or development version of MySQL Server before posting. Anyone should
be able to repeat the bug by just using mysql test <
script_file on your test case or by running the shell or
Perl script that you include in the bug report. Any bug that we are
able to repeat has a high chance of being fixed in the next MySQL
release.
当错误报告中包含对问题的详细描述时,这是最有帮助的。也就是说,给出一个很好的例子,说明您所做的一切导致问题的原因,并准确详细地描述问题本身。最好的报告是包含展示如何重现错误或问题的完整示例的报告。请参阅第 7.9 节“调试 MySQL”。It is most helpful when a good description of the problem is included in the bug report. That is, give a good example of everything you did that led to the problem and describe, in exact detail, the problem itself. The best reports are those that include a full example showing how to reproduce the bug or problem. See Section 7.9, “Debugging MySQL”.
请记住,我们可能会响应包含太多信息的报告,但不会响应包含太少信息的报告。人们经常忽略事实,因为他们认为自己知道问题的原因,并认为某些细节并不重要。一个值得遵循的好原则是,如果你对语句某件事有疑问,那就语句出来。如果我们必须要求您提供初始报告中缺少的信息,那么在报告中多写几行比等待更长的时间更快、更省事。Remember that it is possible for us to respond to a report containing too much information, but not to one containing too little. People often omit facts because they think they know the cause of a problem and assume that some details do not matter. A good principle to follow is that if you are in doubt about stating something, state it. It is faster and less troublesome to write a couple more lines in your report than to wait longer for the answer if we must ask you to provide information that was missing from the initial report.
错误报告中最常见的错误是 (a) 未包含您使用的 MySQL 发行版的版本号,以及 (b) 未完整描述安装 MySQL 服务器的平台(包括平台类型和版本号)。这些都是高度相关的信息,在 100 种情况下,有 99 种情况下,如果没有它们,错误报告就毫无用处。我们经常会收到诸如““为什么这对我不起作用?”之类的问题,然后我们发现所请求的功能并未在该 MySQL 版本中实现,或者报告中描述的错误已在较新的 MySQL 版本中得到修复。错误通常与平台相关。在这种情况下,如果不知道操作系统和平台版本号,我们几乎不可能修复任何问题。The most common errors made in bug reports are (a) not including the version number of the MySQL distribution that you use, and (b) not fully describing the platform on which the MySQL server is installed (including the platform type and version number). These are highly relevant pieces of information, and in 99 cases out of 100, the bug report is useless without them. Very often we get questions like, “Why doesn't this work for me?” Then we find that the feature requested wasn't implemented in that MySQL version, or that a bug described in a report has been fixed in newer MySQL versions. Errors often are platform-dependent. In such cases, it is next to impossible for us to fix anything without knowing the operating system and the version number of the platform.
如果您从源代码编译 MySQL,请记住提供有关您的编译器的信息(如果它与问题相关)。人们经常在编译器中发现错误并认为问题与 MySQL 相关。大多数编译器一直在开发中,并且逐个版本变得更好。要确定您的问题是否取决于您的编译器,我们需要知道您使用的编译器。请注意,每个编译问题都应视为错误并进行相应报告。If you compiled MySQL from source, remember also to provide information about your compiler if it is related to the problem. Often people find bugs in compilers and think the problem is MySQL-related. Most compilers are under development all the time and become better version by version. To determine whether your problem depends on your compiler, we need to know what compiler you used. Note that every compiling problem should be regarded as a bug and reported accordingly.
如果程序产生错误消息,则将该消息包含在报告中非常重要。如果我们尝试从档案中搜索某些内容,最好报告的错误消息与程序生成的错误消息完全匹配。 (即使是字母大小写也应遵守。)最好将整个错误消息复制并粘贴到报告中。您绝对不应该尝试从内存中重现该消息。If a program produces an error message, it is very important to include the message in your report. If we try to search for something from the archives, it is better that the error message reported exactly matches the one that the program produces. (Even the lettercase should be observed.) It is best to copy and paste the entire error message into your report. You should never try to reproduce the message from memory.
如果您在使用 Connector/ODBC (MyODBC) 时遇到问题,请尝试生成跟踪文件并将其与报告一起发送。请参阅如何报告连接器/ODBC 问题或错误。If you have a problem with Connector/ODBC (MyODBC), please try to generate a trace file and send it with your report. See How to Report Connector/ODBC Problems or Bugs.
如果您的报告包含使用mysql 命令行工具,您可以使用 --vertical 选项或 \G 语句终止符使输出更具可读性。本节后面的 EXPLAIN SELECT 示例演示了 \G 的使用。If your report includes long query output lines from test cases that
you run with the mysql command-line tool, you can
make the output more readable by using the
--vertical option or the
\G statement terminator. The
EXPLAIN SELECT
example later in this section demonstrates the use of
\G.
请在报告中包含以下信息:Please include the following information in your report:
您正在使用的 MySQL 发行版的版本号(例如,MySQL 5.7.10)。您可以通过执行mysqladmin version来了解您正在运行的版本。 mysqladmin 程序可以在 MySQL 安装目录下的
bin目录中找到。The version number of the MySQL distribution you are using (for example, MySQL 5.7.10). You can find out which version you are running by executing mysqladmin version. The mysqladmin program can be found in thebindirectory under your MySQL installation directory.您遇到问题的计算机的制造商和型号。The manufacturer and model of the machine on which you experience the problem.
操作系统名称和版本。如果您使用 Windows,通常可以通过双击“我的电脑”图标并下拉“帮助/关于 Windows” 菜单来获取名称和版本号。对于大多数类 Unix 操作系统,您可以通过执行命令
uname -a来获取此信息。The operating system name and version. If you work with Windows, you can usually get the name and version number by double-clicking your My Computer icon and pulling down the “Help/About Windows” menu. For most Unix-like operating systems, you can get this information by executing the commanduname -a.有时内存量(实际和虚拟)是相关的。如果有疑问,请包含这些值。Sometimes the amount of memory (real and virtual) is relevant. If in doubt, include these values.
MySQL 安装中的
docs/INFO_BIN文件的内容。此文件包含有关如何配置和编译 MySQL 的信息。The contents of thedocs/INFO_BINfile from your MySQL installation. This file contains information about how MySQL was configured and compiled.如果您使用的是 MySQL 软件的源发行版,请包含您使用的编译器的名称和版本号。如果您有二进制发行版,请包含发行版名称。If you are using a source distribution of the MySQL software, include the name and version number of the compiler that you used. If you have a binary distribution, include the distribution name.
如果在编译过程中出现问题,请包含确切的错误消息以及发生错误的文件中违规代码周围的几行上下文。If the problem occurs during compilation, include the exact error messages and also a few lines of context around the offending code in the file where the error occurs.
如果 mysqld 死机,您还应该报告该语句这导致 mysqld 意外退出。通常,您可以通过在启用查询日志记录的情况下运行 mysqld 来获取此信息,然后在 mysqld 退出。请参阅第 7.9 节“调试 MySQL”。If mysqld died, you should also report the statement that caused mysqld to unexpectedly exit. You can usually get this information by running mysqld with query logging enabled, and then looking in the log after mysqld exits. See Section 7.9, “Debugging MySQL”.
如果表与问题相关,请在错误报告中包含
SHOW CREATE TABLE语句的输出。这是获取数据库中任何表定义的非常简单的方法。这些信息帮助我们创建与您所经历的情况相匹配的情景。If a database table is related to the problem, include the output from thedb_name.tbl_nameSHOW CREATE TABLEstatement in the bug report. This is a very easy way to get the definition of any table in a database. The information helps us create a situation matching the one that you have experienced.db_name.tbl_name问题发生时有效的 SQL 模式可能非常重要,因此请报告
sql_mode系统变量的值。对于存储过程、存储函数和触发器对象,相关的sql_mode值是创建对象时有效的值。对于存储过程或函数,SHOW CREATE PROCEDURE或SHOW CREATE FUNCTION语句显示相关的 SQL 模式,或者您可以查询INFORMATION_SCHEMA获取信息:The SQL mode in effect when the problem occurred can be significant, so please report the value of thesql_modesystem variable. For stored procedure, stored function, and trigger objects, the relevantsql_modevalue is the one in effect when the object was created. For a stored procedure or function, theSHOW CREATE PROCEDUREorSHOW CREATE FUNCTIONstatement shows the relevant SQL mode, or you can queryINFORMATION_SCHEMAfor the information:SELECT ROUTINE_SCHEMA, ROUTINE_NAME, SQL_MODE FROM INFORMATION_SCHEMA.ROUTINES;
对于触发器,您可以使用此语句:For triggers, you can use this statement:
SELECT EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, TRIGGER_NAME, SQL_MODE FROM INFORMATION_SCHEMA.TRIGGERS;
对于
SELECT语句的性能相关错误或问题,您应始终包含EXPLAIN SELECT ...的输出,并且至少包含SELECT语句产生。您还应该为涉及的每个表包含SHOW CREATE TABLE tbl_name的输出。您提供的有关您的情况的信息越多,别人就越有可能为您提供帮助。For performance-related bugs or problems withSELECTstatements, you should always include the output ofEXPLAIN SELECT ..., and at least the number of rows that theSELECTstatement produces. You should also include the output fromSHOW CREATE TABLEfor each table that is involved. The more information you provide about your situation, the more likely it is that someone can help you.tbl_name以下是一个非常好的错误报告示例。这些语句使用 mysql 命令行工具运行。请注意对语句使用
\G语句终止符,否则会提供非常长且难以阅读的输出行。The following is an example of a very good bug report. The statements are run using the mysql command-line tool. Note the use of the\Gstatement terminator for statements that would otherwise provide very long output lines that are difficult to read.mysql>
SHOW VARIABLES;mysql>SHOW COLUMNS FROM ...\G<output from SHOW COLUMNS>mysql>EXPLAIN SELECT ...\G<output from EXPLAIN>mysql>FLUSH STATUS;mysql>SELECT ...;<A short version of the output from SELECT, including the time taken to run the query>mysql>SHOW STATUS;<output from SHOW STATUS>如果在运行 mysqld 时出现错误或问题,请尝试提供重现异常的输入脚本。该脚本应包含任何必要的源文件。脚本越能准确地再现您的情况就越好。如果您可以制作可重现的测试用例,则应将其上传以附加到错误报告中。If a bug or problem occurs while running mysqld, try to provide an input script that reproduces the anomaly. This script should include any necessary source files. The more closely the script can reproduce your situation, the better. If you can make a reproducible test case, you should upload it to be attached to the bug report.
如果您无法提供脚本,则至少应在报告中包含 mysqladmin 变量扩展状态进程列表 的输出,以提供有关系统运行情况的一些信息If you cannot provide a script, you should at least include the output from mysqladmin variables extended-status processlist in your report to provide some information on how your system is performing.
如果您无法生成只有几行的测试用例,或者测试表太大而无法包含在错误报告中(超过 10 行),您应该使用 mysqldump 转储表并创建一个
README文件描述您的问题。使用 tar 和 gzip 或 zip 创建文件的压缩存档。当您在 http://bugs.mysql.com/ 为我们的错误数据库发起错误报告后,请单击错误报告中的“文件”选项卡,获取有关将存档上传到错误数据库的说明。If you cannot produce a test case with only a few rows, or if the test table is too big to be included in the bug report (more than 10 rows), you should dump your tables using mysqldump and create aREADMEfile that describes your problem. Create a compressed archive of your files using tar and gzip or zip. After you initiate a bug report for our bugs database at http://bugs.mysql.com/, click the Files tab in the bug report for instructions on uploading the archive to the bugs database.如果您认为 MySQL 服务器从语句中产生了奇怪的结果,请不仅包括结果,还包括您对结果应该是什么的看法,以及描述您的错误基础的解释。意见。If you believe that the MySQL server produces a strange result from a statement, include not only the result, but also your opinion of what the result should be, and an explanation describing the basis for your opinion.
当你提供问题的例子时,最好使用你实际情况中存在的表名、变量名等,而不是想出新的名称。该问题可能与表或变量的名称有关。这些情况也许很少见,但安全总比后悔好。毕竟,您提供一个符合您实际情况的示例应该会更容易,而且对我们来说绝对更好。如果您不希望错误报告中的其他人看到您的数据,您可以使用“文件”选项卡上传该数据,如前所述。如果信息确实是绝密的,并且您甚至不想向我们展示,请继续使用其他名称提供示例,但请将此视为最后的选择。When you provide an example of the problem, it is better to use the table names, variable names, and so forth that exist in your actual situation than to come up with new names. The problem could be related to the name of a table or variable. These cases are rare, perhaps, but it is better to be safe than sorry. After all, it should be easier for you to provide an example that uses your actual situation, and it is by all means better for us. If you have data that you do not want to be visible to others in the bug report, you can upload it using the Files tab as previously described. If the information is really top secret and you do not want to show it even to us, go ahead and provide an example using other names, but please regard this as the last choice.
如果可能,请包括为相关程序提供的所有选项。例如,指示启动 mysqld 服务器时使用的选项,以及用于运行任何 MySQL 客户端程序的选项。 mysqld 和 mysql 等程序的选项,以及configure 脚本通常是解决问题的关键并且非常相关。将它们包括在内绝不是一个坏主意。如果您的问题涉及用 Perl 或 PHP 等语言编写的程序,请包含语言处理器的版本号以及程序使用的任何模块的版本。例如,如果您有一个使用
DBI和DBD::mysql模块的 Perl 脚本,请包含 Perl、DBI和DBD::mysql的版本号。Include all the options given to the relevant programs, if possible. For example, indicate the options that you use when you start the mysqld server, as well as the options that you use to run any MySQL client programs. The options to programs such as mysqld and mysql, and to the configure script, are often key to resolving problems and are very relevant. It is never a bad idea to include them. If your problem involves a program written in a language such as Perl or PHP, please include the language processor's version number, as well as the version for any modules that the program uses. For example, if you have a Perl script that uses theDBIandDBD::mysqlmodules, include the version numbers for Perl,DBI, andDBD::mysql.如果您的问题与权限系统相关,请包含 mysqladmin reload,以及尝试连接时收到的所有错误消息。当您测试权限时,您应该执行mysqladmin 重新加载版本并尝试连接给您带来麻烦的程序。If your question is related to the privilege system, please include the output of mysqladmin reload, and all the error messages you get when trying to connect. When you test your privileges, you should execute mysqladmin reload version and try to connect with the program that gives you trouble.
如果您有针对错误的补丁,请务必将其包含在内。但是,如果您不提供一些必要的信息(例如显示补丁修复的错误的测试用例),请不要假设该补丁就是我们所需要的,或者我们可以使用它。我们可能会发现您的补丁有问题,或者我们可能根本不理解它。如果是这样,我们就不能使用它。If you have a patch for a bug, do include it. But do not assume that the patch is all we need, or that we can use it, if you do not provide some necessary information such as test cases showing the bug that your patch fixes. We might find problems with your patch or we might not understand it at all. If so, we cannot use it.
如果我们无法验证补丁的确切用途,我们就不会使用它。测试用例在这里对我们有帮助。表明该补丁可以处理所有可能发生的情况。如果我们发现补丁不起作用的临界情况(即使是罕见的情况),它可能毫无用处。If we cannot verify the exact purpose of the patch, we will not use it. Test cases help us here. Show that the patch handles all the situations that may occur. If we find a borderline case (even a rare one) where the patch will not work, it may be useless.
对错误是什么、为什么会发生或者它依赖什么的猜测通常是错误的。如果不首先使用调试器来确定错误的真正原因,即使是 MySQL 团队也无法猜测此类事情。Guesses about what the bug is, why it occurs, or what it depends on are usually wrong. Even the MySQL team cannot guess such things without first using a debugger to determine the real cause of a bug.
在错误报告中表明您已检查了参考手册和邮件存档,以便其他人知道您已尝试自行解决问题。Indicate in your bug report that you have checked the reference manual and mail archive so that others know you have tried to solve the problem yourself.
如果您的数据出现损坏或在访问特定表时遇到错误,请首先使用
CHECK TABLE检查您的表。如果该语句报告任何错误:If your data appears corrupt or you get errors when you access a particular table, first check your tables withCHECK TABLE. If that statement reports any errors:InnoDB崩溃恢复机制会在服务器被终止后重新启动时处理清理工作,因此在典型操作中无需“修复”表。如果您遇到InnoDB表错误,请重新启动服务器并查看问题是否仍然存在,或者错误是否仅影响内存中的缓存数据。如果磁盘上的数据损坏,请考虑在启用innodb_force_recovery选项的情况下重新启动,以便转储受影响的表。TheInnoDBcrash recovery mechanism handles cleanup when the server is restarted after being killed, so in typical operation there is no need to “repair” tables. If you encounter an error withInnoDBtables, restart the server and see whether the problem persists, or whether the error affected only cached data in memory. If data is corrupted on disk, consider restarting with theinnodb_force_recoveryoption enabled so that you can dump the affected tables.对于非事务性表,请尝试使用
REPAIR TABLE或使用 myisamchk。请参阅第 7 章,MySQL 服务器管理。For non-transactional tables, try to repair them withREPAIR TABLEor with myisamchk. See Chapter 7, MySQL Server Administration.
如果您运行的是 Windows,请验证
lower_case_table_names使用SHOW VARIABLES LIKE 'lower_case_table_names'语句。此变量影响服务器处理数据库和表名称的字母大小写的方式。它对给定值的影响应如第 11.2.3 节“标识符区分大小写” 中所述。If you are running Windows, please verify the value oflower_case_table_namesusing theSHOW VARIABLES LIKE 'lower_case_table_names'statement. This variable affects how the server handles lettercase of database and table names. Its effect for a given value should be as described in Section 11.2.3, “Identifier Case Sensitivity”.如果您经常遇到损坏的表,您应该尝试找出发生这种情况的时间和原因。在这种情况下,MySQL 数据目录中的错误日志可能包含有关所发生情况的一些信息。 (这是名称中带有
.err后缀的文件。)请参阅第 7.4.2 节“错误日志”。请将此文件中的任何相关信息包含在您的错误报告中。通常,如果在更新过程中没有任何东西杀死表,mysqld 应该永远不会损坏表。如果您能找到 mysqld 死机的原因,我们就可以更轻松地为您提供问题的解决方案。请参阅第 B.3.1 节“如何确定导致问题的原因”。If you often get corrupted tables, you should try to find out when and why this happens. In this case, the error log in the MySQL data directory may contain some information about what happened. (This is the file with the.errsuffix in the name.) See Section 7.4.2, “The Error Log”. Please include any relevant information from this file in your bug report. Normally mysqld should never corrupt a table if nothing killed it in the middle of an update. If you can find the cause of mysqld dying, it is much easier for us to provide you with a fix for the problem. See Section B.3.1, “How to Determine What Is Causing a Problem”.如果可能,请下载并安装最新版本的 MySQL Server 并检查它是否可以解决您的问题。所有版本的 MySQL 软件都经过彻底测试,应该可以正常运行。我们相信让一切尽可能向后兼容,并且您应该能够毫无困难地切换 MySQL 版本。请参阅第 2.1.2 节“要安装哪个 MySQL 版本和发行版”。If possible, download and install the most recent version of MySQL Server and check whether it solves your problem. All versions of the MySQL software are thoroughly tested and should work without problems. We believe in making everything as backward-compatible as possible, and you should be able to switch MySQL versions without difficulty. See Section 2.1.2, “Which MySQL Version and Distribution to Install”.