Mysql slow query log is on but not logging anything

Running:
Ubuntu Server 10.04
Mysql 5.1.41

I have the following in /etc/mysql/my.cnf

slow_query_log = 1
slow_query_log_file = /var/log/mysqld/log-slow-queries.log
long_query_time = 1

log file should be writable

drwxrwxrwx  2 mysql mysql    4096 2010-10-20 13:41 mysqld
-rwxrwxrwx  1 mysql mysql    0    2010-10-20 13:41 log-slow-queries.log

Nothing is showing up in the log or in mysql.slow_log table. It looks like it's enabled

mysql> show variables like '%SLOW%';
+---------------------+--------------------------------------+
| Variable_name       | Value                                |
+---------------------+--------------------------------------+
| log_slow_queries    | ON                                   |
| slow_launch_time    | 2                                    |
| slow_query_log      | ON                                   |
| slow_query_log_file | /var/log/mysqld/log-slow-queries.log |
+---------------------+--------------------------------------+
4 rows in set (0.00 sec)

Does this mean I have no slow queries? I tried running select sleep(3); but that doesn't show up.

Is there a query I can run that will show up in the log if everything is configured correctly?


I had the same problem. Solved it after reading this: https://stackoverflow.com/a/11861305/686304

In order to enable slow queries logging, you need first to enable general logging.

Just set 'general_log' to 'ON' (in my.cnf)

general_log = 1

The slow query log consists of all SQL statements that took more than long_query_time seconds to execute and (as of MySQL 5.1.21) required at least min_examined_row_limit rows to be examined.

http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html

What's your min_examined_row_limit set to?