7日志慢查询错误

7日志慢查询错误

本文介绍了MySQL 5.7日志慢查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在mysql 5.7上启用慢速查询日志并收到此错误:

I'm trying to enable Slow Query Logging on mysql 5.7 and getting this error:

2016-04-27T14:55:51.934612Z 0 [错误]未知变量'log-slow-queries =/var/log/mysql-query.log'

2016-04-27T14:55:51.934612Z 0 [ERROR] unknown variable 'log-slow-queries=/var/log/mysql-query.log'

2016-04-27T14:55:51.934639Z 0 [错误]正在中止

2016-04-27T14:55:51.934639Z 0 [ERROR] Aborting

在我的/etc/my.cnf文件中,我定义了"log-slow-queries =/var/log/mysql-query.log",但我将假定在5.7中该无效.启用查询日志记录的正确my.cnf设置是什么?谢谢,

In my /etc/my.cnf file I have "log-slow-queries=/var/log/mysql-query.log" defined, but I'm going to assume that in 5.7 that is invalid. What is the correct my.cnf settings to enable query logging?Thanks,

推荐答案

MySQL系统变量的名称为 slow_query_log_file

Name of the MySQL system variable is slow_query_log_file

要启用它,您需要将 slow_query_log设置为ON或1

And to enable it, you need to set slow_query_log to ON or 1

MySQL参考手册:sysvar_slow_query_log_file

MySQL参考手册:sysvar_slow_query_log

这篇关于MySQL 5.7日志慢查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:19