Mysql 5.7 : How to enable slow query logs

If you just uncomment the slow query log variable in mysqld.conf , you can’t start your mysql server. it’s because the variable name has changed, the following configuration works well for me.

nano /etc/mysql/mysql.conf.d/mysqld.conf

# 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

Leave a Reply

Your email address will not be published. Required fields are marked *