I ran into an interesting bit of code today. Sometimes a database gets too big and you only want the structure. In that situation, there’s the -d parameter. In other cases, you want not only the structure, but some of the data too. By using the –where parameter creatively, we can limit the number of rows mysqldump returns.
mysqldump --where="true LIMIT X" schema > output.sql
Unfortunately, this doesn’t allow for any granularity in the number of rows returned. Still, “get me the database and at most 1000 rows from each table” can be helpful in certain situations.