Tuesday, March 9, 2010

enable mysql slow query log in my.cnf

Step 1:  add following two line under mysqld
[mysqld]
log-slow-queries=/var/log/mysql-slow.log
long_query_time = 10

step 2: create an empty log file and chage the owner
  vim /var/log/mysql-slow.log
  chown mysql:mysql /var/log/mysql-slow.log

step 3: reboot mysql
  /etc/init.d/mysqld stop
  /etc/init.d/mysqld start

No comments:

Post a Comment