按照MySQL官方文档可将my.ini(Microsoft Windows)或my.cnf(UNIX/Linux)中mysqld段的log-warnings
设置为1以上的数字,如2,重启mysqld生效。
-
--log-warnings[=
level
],-W [
level
]Command-Line Format:
--log-warnings[=#] 或-
W [#]
Option-File Format:
log-warnings[=#]
System Variable Name:
log_warnings
Type:numeric
Default:1
32-bit Range:0 .. 4294967295
64-bit Range:0 .. 18446744073709547520
Print out warnings such as Aborted connection...
to the error log. This option is enabled (1) by default. To disable it, use --log-warnings=0. Specifying the option without a level
value increments the current value by 1. Enabling this option by setting it greater than 0 is recommended, for example, if you use replication (you get more information about what is happening, such as messages about network failures and reconnections). If the value is greater than 1, aborted connections are written to the error log. See Section C.5.2.11, “Communication Errors and Aborted Connections”.
If a slave server was started with --log-warnings enabled, the slave prints messages to the error log to provide information about its status, such as the binary log and relay log coordinates where it starts its job, when it is switching to another relay log, when it reconnects after a disconnect, and so forth. As of MySQL 5.1.38, the server logs messages about statements that are unsafe for statement-based logging if --log-warnings is greater than 0.
参考:http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_log-warnings
本文转自 urey_pp 51CTO博客,原文链接:http://blog.51cto.com/dgd2010/1395778,如需转载请自行联系原作者