Question

I'm new to MySQL. MySQL version is 5.0.95. I have enabled the slow query log and edited in the cnf file the location of slow query log but I couldn't see slow query log files in the server location after I edited in cnf file, so I did manually create slow-query.log in the server location. Correct me if I'm wrong and now I want to view the slow-query.log file using 'mysqldumpslow /var/log/mysql/mysql-slow.log' but I couldn't view its contents. Is there any other specific query to view the slow-query log files?

Was it helpful?

Solution

Lower long_query_time. The default is a nearly-useless 10 seconds.

The actual location of the slowlog is a bit tricky. Search your entire disk if it does not show up in any obvious place. Don't create the file yourself, it "mysql" may not have permissions to write to it, thereby confusing you further.

Test with SELECT SLEEP(11); That should show up even with a cutoff of 10.

Yes, mysqlsdumpslow is one way to dump it. Better is pt-query-digest.

Do you realize how antique 5.0 is? Some day, you will upgrade. But it will be painful to go through 5.1, 5.5, 5.6, 5.7, to get to the current 8.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top