为什么"log_slow_queries"会破坏"my.cnf"? [英] Why does `log_slow_queries` break `my.cnf`?

查看:97
本文介绍了为什么"log_slow_queries"会破坏"my.cnf"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

这是/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行,则会收到以下错误:

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

我想念什么?

推荐答案

好像MySQL更改了格式.现在是slow_query_log而不是log_slow_queries.

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

这有效:

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

这篇关于为什么"log_slow_queries"会破坏"my.cnf"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆