centos下mysql启用通用查询日志和慢查询日志

Syntax for /etc/my.cnf in Red Hat 9:

[mysqld]

log=/var/log/mysql/mysql.log #通用查询日志
long_query_time=2 #慢查询时间,单位秒,默认为10秒
log-slow-queries=/var/log/mysql/log-slow-queries.log #慢查询日志

You must create the file manually and change owners this way:

mkdir /var/log/mysql
touch /var/log/mysql/log-slow-queries.log
touch /var/log/mysql/mysql.log
chown mysql.mysql -R /var/log/mysql

 

 

参考:http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html

posted on 2013-11-28 13:03  一个石头  阅读(918)  评论(0)    收藏  举报