Take the 2-minute tour ×
# ls
error.log       mysql-slow.log.1.gz  mysql-slow.log.3.gz  mysql-slow.log.5.gz
mysql-slow.log  mysql-slow.log.2.gz  mysql-slow.log.4.gz  mysql-slow.log.6.gz

This is what I see. How do I view them? Why are there so many files anywyay?

What if I want to read them all as one file?

# ls -lh
total 36K
-rw-rw---- 1 mysql adm 6.5K 2012-02-12 21:59 error.log
-rw-r----- 1 mysql adm  174 2012-02-19 06:25 mysql-slow.log
-rw-r----- 1 mysql adm  154 2012-02-18 06:25 mysql-slow.log.1.gz
-rw-r----- 1 mysql adm  154 2012-02-17 06:25 mysql-slow.log.2.gz
-rw-r----- 1 mysql adm  154 2012-02-16 06:25 mysql-slow.log.3.gz
-rw-r----- 1 mysql adm  154 2012-02-15 06:25 mysql-slow.log.4.gz
-rw-r----- 1 mysql adm  154 2012-02-14 06:25 mysql-slow.log.5.gz
-rw-r----- 1 mysql adm  154 2012-02-13 06:25 mysql-slow.log.6.gz
share|improve this question

1 Answer 1

up vote 1 down vote accepted

zcat mysql-slow* | less

There are a few of them because they have been auto rotated (probably by logrotate).

If you don't have zcat installed you could run gunzip.

gunzip mysql-slow*.gz

Show us a ls -l to get a sense of when these files were rotated.

share|improve this answer
I edited with ls -l –  Alex Feb 19 '12 at 8:01
After doing that, I got mysql-slow.log.1 , mysql-slow.log.2, ... I CAT each one, but they're all empty. (Also, Can I join them all instead of reading each file individually?) –  Alex Feb 19 '12 at 8:02
An empty file is an empty log. That's generally a good thing for the MySQL slow query log. You can change the threshold in you config to try to get MySQL to report on faster running queries. –  Joel K Feb 19 '12 at 16:32

Your Answer


