Compared to previous version in MySQL 5.6 they introduced different way for logging slow queries.
In this article I will show you to quickly and correctly enable the slow query log in MySQL 5.6 which is extremely useful for debugging application performance issues.
Enable Slow Query Log in MySQL 5.6
Follow the below steps to enable slow query log in MySQL 5.6.
1. Login to your MySQL server.
2. Open the my.cnf file in your favourite test editor.
# vim /etc/my.cnf
Add the following line in:
long_query_time=1 slow_query_log=1 slow_query_log_file="/var/log/mysql/log-slow-queries.log"
Where;
long_query_time – Defines the minimum threshold for the “slow query” designation.
1 means log all queries that take more than 1s to execute slow_query_log – Value of 1 means enable. 0 means disable slow_query_log_file – Log file path. This path generally be at the same location as mysql-error.log
3. Reload the MySQL server it will not cause an interruption.
# service mysql reload
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
Leave a Comment