问题描述
我正在尝试在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日志慢查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!