Comparing database states

Quick and dirty way two compare two different states of a database using mysqldump:

$ mysqldump --order-by-primary --extended-insert=FALSE --compact --user=X --password database > before.sql
$ mysqldump --order-by-primary --extended-insert=FALSE --compact --user=X --password database > after.sql
$ diff before.sql after.sql > diff.txt

The problem I ran into the first time I tried this was that mysqldump inserts by default several rows in the same line, which makes difficult to identify what is actually new. That gets fixed with –extended-insert=FALSE. The other two options (–order-by-primary and –compact) just makes diff’s life easier and gives less clutter.