Why does `log_slow_queries` break `my.cnf`?
Asked Answered
R

1

22

Why can't I use slow_query_log on MySQL 5.6 on CentOS 6.4?

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
...

## Logging

## *** THESE LOGS WORK JUST FINE ***
log_error                       = /var/log/mysql/error.log
general_log_file                = /var/log/mysql/mysql.log
general_log                     = 1

## *** THESE LOGS BREAK MYSQL ***
#log_slow_queries               = /var/log/mysql/slow.log
#long_query_time                = 5
#log-queries-not-using-indexes

Here's the /var/log/mysql directory:

$ ls -lh
total 100K
-rw-r----- 1 mysql root   47K Nov 22 06:02 error.log
-rw-rw---- 1 mysql root   42K Nov 22 06:05 mysql.log
-rw-rw---- 1 mysql mysql    0 Nov 22 06:01 slow.log

If I uncomment the log_slow_query lines in the /etc/my.cnf I receive the following error:

$ /etc/init.d/mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL..... ERROR! The server quit without updating PID file (/var/lib/mysql/server.domain.com.pid).

What am I missing?

Rahel answered 22/11, 2013 at 4:18 Comment(0)
R
48

Looks like MySQL changed the format. Now it's slow_query_log not log_slow_queries.

This works:

slow_query_log                  = 1
slow_query_log_file             = /var/log/mysql/slow.log
long_query_time                 = 5
Rahel answered 22/11, 2013 at 4:38 Comment(1)
log_slow_queries was deprecated in MySQL 5.1.29 by slow_query_log. The MySQL 5.1 Reference Manual has more details: dev.mysql.com/doc/refman/5.1/en/…Rahel

© 2022 - 2024 — McMap. All rights reserved.