How can I enable MySQL's slow query log without restarting MySQL?

前端 未结 8 994
情歌与酒
情歌与酒 2020-11-28 19:44

I followed the instructions here: http://crazytoon.com/2007/07/23/mysql-changing-runtime-variables-with-out-restarting-mysql-server/ but that seems to only set the threshold

8条回答
  •  臣服心动
    2020-11-28 19:59

    For slow queries on version < 5.1, the following configuration worked for me:

    log_slow_queries=/var/log/mysql/slow-query.log
    long_query_time=20
    log_queries_not_using_indexes=YES
    

    Also note to place it under [mysqld] part of the config file and restart mysqld.

提交回复
热议问题