I'm trying to log MySQL slow queries, but I can't turn it on, I will explain all my steps:

  • I Edit my.cnf and add the following lines

long_query_time = 1
slow_query_log_file = /home/mysql/slow_queries.log
slow_query_log = 1

  • Give mysql user permitions to write on the file

chown -R mysql:mysql /home/mysql

  • Restart the service

/etc/init.d/mysqld restart

I check the MySQL logs and don't find any error during the restart!


This depend of you MySQL version. If you're running MySQL 5.0, you need to use :

log_slow_queries = 1


And only with new version (MySQL 5.1), you can use this :

slow_query_log = 1


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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