To enable slow query log, it is have to add one line into my.cnf.
I have MySQL installation on a Centos server.
It is MySQL 5.0.22 i686.
Let’s go through the details of setting of it.
Open my.cnf which is located at /etc/
add following under mysqld section.
log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 5
The key point is to manually create the mysql-slow.log file.
chmod mysql.mysql -R /var/log/mysql
Last step is to restart mysql server.
After minutes, I saw some records in this log file.
The next question is how to analyse the slow queries log and optimize the program of MySQL.