Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

[mysqld]
log-slow-queries=/var/log/mysqld-slow-queries.log
share|improve this answer

Your Answer

 
discard

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.