mysqldump: dump rows matching certain criteria, or limit number of dumped rows

To limit the number of rows dumped by mysqldump, you can do:

mysqldump -u [user] -p[password] --where="true LIMIT 5" [database] [tablename] > outputfilename.sql

You could select other criteria as well:

mysqldump -u [user] -p[password] --where="userid > 24" [database] [tablename] > outputfilename.sql

Advertisements