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:

  • 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 aby error during the restart!

Thanks in advance!!

Best Regards,
Pedro

share|improve this question
up vote 4 down vote accepted

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

log_slow_queries = 1

http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_log-slow-queries

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

slow_query_log = 1

http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_log_slow_queries

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.