Hi,
I want to activate mysq slow logs.
To see what queries are slow to respond (and how to improve them)
I thought it was just too comment a line out in /etc/mysql/my.cnf
But I can't find it.
mysql slow log activate
Re: mysql slow log activate
You need too add the following 2 lines in /etc/mysql/my.cnf
And restart mysqld, so it can read the new config file.
By default a query is slow if it takes more then 10 seconds to execute,
but you can change this by adding the following line:
now it is 12 seconds 
You probably also want to add the new logfile to logrotate,
so it doesn't get too big:
The should already be a file for mysql:
/etc/logrotate.d/mysql
Just add the new file
/var/log/mysql/mysql.err /var/log/mysql/mysql.log /var/log/mysql/mysqld.err /var/log/mysql/mysql_slow.log {
Code: Select all
log_slow_queries = 1;
slow_query_log_file = /var/log/mysql/mysql_slow.log
Code: Select all
/etc/init.d/mysql restart
but you can change this by adding the following line:
Code: Select all
long_query_time = 12

You probably also want to add the new logfile to logrotate,
so it doesn't get too big:
The should already be a file for mysql:
/etc/logrotate.d/mysql
Just add the new file
/var/log/mysql/mysql.err /var/log/mysql/mysql.log /var/log/mysql/mysqld.err /var/log/mysql/mysql_slow.log {