mysql 5.7 log-slow-queries error

僤鯓⒐⒋嵵緔 提交于 2019-12-20 13:32:17

问题


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

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 [ERROR] Aborting

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,


回答1:


Name of the MySQL system variable is slow_query_log_file

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

MySQL Reference Manual: sysvar_slow_query_log_file

MySQL Reference Manual: sysvar_slow_query_log




回答2:


log-slow-queries is deprecated

See http://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html

# Here you can see queries with especially long duration
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-queries.log
long_query_time = 1


来源:https://stackoverflow.com/questions/36893799/mysql-5-7-log-slow-queries-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!