Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our application is using a very busy MySQL database with lots of reads, sometimes I don't want to look at the MySQL log files, I just want the output from mytop for the last 5 minutes. How do I write the output from mytop to a file?

Given that "mytop -u root --prompt > database.load" does not work?

Update I was using --prompt instead of -p with the -b flag, which kept on throwing an exception. So the solution would have been to do mytop -u root -p password > database.load

share|improve this question

You could use the -b option from mytop. From the manual page:

   -b or --batch or --batchmode
       In batch mode, mytop runs only once, does not clear the screen, and places no limit on the number of lines it will
       print. This is suitable for running periodically (perhaps from cron) to capture the information into a file for later
       viewing. You might use batch mode in a CGI script to occasionally display your MySQL server status on the web.

       Default: unset.
share|improve this answer
hi, the batchmode not showing qps now, what i have to do so this will show queries per second in batch mode also, i want to log this in a file, thank you – ɹɐqʞɐ zoɹǝɟ Feb 5 at 12:59

like this:

mytop -b > /tmp/mytop.log

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.