为什么`log_slow_queries`打破了'my.cnf`?

时间:2013-11-22 04:18:42

标签: mysql performance my.cnf mysql-slow-query-log

为什么我不能在CentOS 6.4上的MySQL 5.6上使用slow_query_log?

[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

这是/var/log/mysql目录:

$ 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

如果我取消注释/etc/my.cnf中的log_slow_query行,我收到以下错误:

$ /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).

我错过了什么?

1 个答案:

答案 0 :(得分:35)

看起来MySQL改变了格式。现在它slow_query_log而非log_slow_queries

这有效:

slow_query_log                  = 1
slow_query_log_file             = /var/log/mysql/slow.log
long_query_time                 = 5