本文共 1571 字,大约阅读时间需要 5 分钟。
The MySQL slow query log enables you to log all queries that take longer than a specified number of seconds to execute. This should help identify any queries that are not performing sufficiently.
All that is required is two additional lines in the MySQL configuration file “my.cnf” in the [mysqld] section.
The above configuration will log any queries taking longer than 4 seconds to execute in to the specified log file.
MySQL appears to require that the specified log file exists otherwise the logging is disabled and the error below
appears in the MySQL log. (Or it may be that it didn’t have permissions to create the file. I haven’t investigated).
To create the log file I did the following:
The third command is probably unnecessary, but it meant that the permissions matched the mysqld.log
in the same directory.
Once this is done MySQL needs to be restarted to start the query logging:
This entry was posted on Monday, October 13th, 2008 at 5:34 pm and is filed under . You can follow any responses to this entry through the feed. You can , or from your own site.
本文转自holy2009 51CTO博客,原文链接:http://blog.51cto.com/holy2010/362340
转载地址:http://nogfl.baihongyu.com/