In MySQL 5.6, they introduced a different way for logging slow queries compared to previous versions. This article will show you how to quickly, and correctly enable the slow query log which is extremely useful for debugging application performance issues.
Enable Slow Query Log in MySQL 5.6
- Login to your MySQL host
- Open the my.cnf file in your favorite text editor:
- Add the following properties:
long_query_time – Defines the minimum threshold for the “slow query” designation. 1 means log all queries that take more than 1s to executeslow_query_log – Value of 1 means enable. 0 means disableslow_query_log_file – Log file path. This path generally be at the same location as mysql-error.log
- Reload the MySQL configuration (will not cause an interruption)
service mysql reload
2 thoughts on “MySQL 5.6 – How to log slow queries (Linux)”
# service mysqld reload
I’m pretty sure there is no way to reload the configuration file without restarting mysqld.