Simple MySQL Diff

Dead simple way to diff two MySQL databases (probably applicable to others as well).  Just create a new file with the following:


mysqldump database1 --no-data -u username -p > db1.sql
mysqldump database2 --no-data -u username -p > db2.sql
diff db1.sql db2.sql | grep \( -B 1

Make sure to chmod o+x the file to enable execution. This will output the locations of changes in your databases, and you can go to the line numbers to find the actual changes.

Leave a Reply