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?
1 Answer
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.
-
Thanks Rick, Can i just upgrade mysql from 5.0 to 5.7 or have to go through one by one– jackNov 14, 2019 at 1:37
-
@jack - One by one; be sure to run mysql_upgrade at each step. Or dump the data and reload it on 5.7. But be cautious -- there ware a lot of changes. I can't think of any show-stoppers. (Coming from 4.0 and going to 8.0 have major hiccups.) Nov 14, 2019 at 1:44