Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I want to take a dump of a database, but the condition is to have only 100 records from each table in the DB?

share|improve this question

I found a small hack for doing that in the MySQL manual (comment):

mysqldump -u [username] -p [dbname] {--opt} --where="true limit 100" > dump.sql
share|improve this answer
That's hideous and hilarious. Well-played. And here I was writing a script! – BMDan Aug 24 '10 at 10:26
People can be really creative in finding solutions :D Like that proverb, all roads lead to Rome. – Lekensteyn Aug 24 '10 at 10:29
I'm starting to believe that in shell every problem can be solved in one line. – Janne Pikkarainen Aug 24 '10 at 12:32

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.