MySQL Slow Query Log File
Updated on November 14, 2023
By Pete Freitag
By Pete Freitag
MySQL has a feature that allows you to log slow running queries to a file. To enable you just need to add some lines to your my.cnf
file, and restart. Add the following:
log-slow-queries = /var/log/mysql/mysql-slow.log long_query_time = 1
The above will log queries taking longer than one second to the specified log file.
You can read more in the MySQL Reference Manual
MySQL Slow Query Log File was first published on February 17, 2005.
Discuss / Follow me on Twitter ↯
Tweet Follow @pfreitagComments
Thank you for this. I was looking for a way to debug mysql as I've been having some problems.
Andrew
http://www.tv-links.eu
Andrew
http://www.tv-links.eu
by Andrew on 03/15/2010 at 7:21:56 AM UTC
I need catch all id and message avents (1064 You have a error in your SQL syntaxis) from MySQL database, because in the log, log-error the messages is not very good description..
Thanks, Rolando