Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to log mysql slow queries, but I can't turn it on.

I will explain all my steps:

Open and Edit my.cnf and add the following lines:

long_query_time = 5
slow_query_log_file = /myfolder/slowq.log
log_slow_queries = 1                     =>(I have MySQL 5.0.7)

Give mysql user permitions to write on the file:

chown -R mysql:mysql /var/lib/mysql

Create the file:

touch /myfolder/slowq.log

Chmod for this file to 777.

service mysqld restart

From MySQL Admin Panel I can see that the "log_slow_queries" var is OFF! Also no logs are created.

Thanks in advance! Best Regards, Panos.

share|improve this question
up vote 1 down vote accepted

into my.cnf write this under mysqld then you need to restart the server(mysql) also make sure you can write int the directory where you want to log

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.