Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.