The MySQL server and most MySQL clients are compiled with the DBUG package originally created by Fred Fish. When you have configured MySQL for debugging, this package makes it possible to get a trace file of what the program is doing. MySQL服务器和大多数MySQL客户端都是用Fred Fish最初创建的DBUG包编译的。当您配置MySQL进行调试时,此包可以获取程序正在进行的操作的跟踪文件。See Section 5.9.1.2, “Creating Trace Files”.请参阅第5.9.1.2节,“创建跟踪文件”。
This section summarizes the argument values that you can specify in debug options on the command line for MySQL programs that have been built with debugging support.本节总结了可以在命令行上的调试选项中为已使用调试支持构建的MySQL程序指定的参数值。
The DBUG package can be used by invoking a program with the DBUG包可以通过调用带有--debug[=
or debug_options
]-# [
option. debug_options
]--debug[=debug_options]
或-# [debug_objects]
选项的程序来使用。If you specify the 如果指定--debug
or -#
option without a debug_options
value, most MySQL programs use a default value. --debug
或-#
选项而不指定debug_options
值,则大多数MySQL程序使用默认值。The server default is 服务器默认值在Unix上为d:t:i:o,/tmp/mysqld.trace
on Unix and d:t:i:O,\mysqld.trace
on Windows. The effect of this default is:d:t:i:o,/tmp/mysqld.trace
,在Windows上为d:t:i:O,\mysqld.trace
。此默认值的效果是:
d
: Enable output for all debug macros:为所有调试宏启用输出
t
: Trace function calls and exits:跟踪函数调用和退出
i
: Add PID to output lines:将PID添加到输出行
o,/tmp/mysqld.trace
, O,\mysqld.trace
: Set the debug output file.:设置调试输出文件。
Most client programs use a default 大多数客户端程序使用默认的debug_options
value of d:t:o,/tmp/
, regardless of platform.program_name
.tracedebug_options
值d:t:o,/tmp/program_name.trace
,而不管平台如何。
Here are some example debug control strings as they might be specified on a shell command line:以下是一些可能在shell命令行上指定的调试控制字符串示例:
--debug=d:t --debug=d:f,main,subr1:F:L:t,20 --debug=d,input,output,files:n --debug=d:t:i:O,\\mysqld.trace
For mysqld, it is also possible to change DBUG settings at runtime by setting the 对于mysqld,还可以通过设置debug
system variable. This variable has global and session values:debug
系统变量在运行时更改DBUG
设置。此变量具有全局值和会话值:
mysql>SET GLOBAL debug = '
mysql>debug_options
';SET SESSION debug = '
debug_options
';
Changing the global 更改全局debug
value requires privileges sufficient to set global system variables. debug
值需要足够的权限来设置全局系统变量。Changing the session 更改会话debug
value requires privileges sufficient to set restricted session system variables. debug
值需要足够的权限来设置受限的会话系统变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
The debug_options
value is a sequence of colon-separated fields:debug_options
值是一系列用冒号分隔的字段:
field_1:field_2:...:field_N
Each field within the value consists of a mandatory flag character, optionally preceded by a 值中的每个字段都由一个必填标志字符组成,可以在前面加一个+
or -
character, and optionally followed by a comma-separated list of modifiers:+
或-
字符,也可以在后面加一个逗号分隔的修饰符列表:
[+|-]flag[,modifier,modifier,...,modifier]
The following table describes the permitted flag characters. Unrecognized flag characters are silently ignored.下表描述了允许的标志字符。无法识别的标志字符将被自动忽略。
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The leading 前导+
or -
character and trailing list of modifiers are used for flag characters such as d
or f
that can enable a debug operation for all applicable modifiers or just some of them:+
或-
字符和尾随修饰符列表用于标记字符,如d
或f
,可以对所有适用的修饰符或仅对其中一些修饰符启用调试操作:
With no leading 没有前导+
or -
, the flag value is set to exactly the modifier list as given.+
或-
,标志值将设置为给定的修饰符列表。
With a leading 使用前导+
or -
, the modifiers in the list are added to or subtracted from the current modifier list.+
或-
,列表中的修饰符将添加到当前修饰符列表中或从中减去。
The following examples show how this works for the 以下示例显示了d
flag. An empty d
list enabled output for all debug macros. A nonempty list enables output only for the macro keywords in the list.d
标志的工作原理。为所有调试宏启用了空d
列表输出。非空列表仅允许输出列表中的宏关键字。
These statements set the 这些语句将d
value to the modifier list as given:d
值设置为给定的修饰符列表:
mysql>SET debug = 'd';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | d | +---------+ mysql>SET debug = 'd,error,warning';
mysql>SELECT @@debug;
+-----------------+ | @@debug | +-----------------+ | d,error,warning | +-----------------+
A leading 前导+
or -
adds to or subtracts from the current d
value:+
或-
对当前d
值进行加减运算:
mysql>SET debug = '+d,loop';
mysql>SELECT @@debug;
+----------------------+ | @@debug | +----------------------+ | d,error,warning,loop | +----------------------+ mysql>SET debug = '-d,error,loop';
mysql>SELECT @@debug;
+-----------+ | @@debug | +-----------+ | d,warning | +-----------+
Adding to “all macros enabled” results in no change:添加到“启用所有宏”不会导致任何更改:
mysql>SET debug = 'd';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | d | +---------+ mysql>SET debug = '+d,loop';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | d | +---------+
Disabling all enabled macros disables the 禁用所有启用的宏将完全禁用d
flag entirely:d
标志:
mysql>SET debug = 'd,error,loop';
mysql>SELECT @@debug;
+--------------+ | @@debug | +--------------+ | d,error,loop | +--------------+ mysql>SET debug = '-d,error,loop';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | | +---------+