Compare two MySQL databases and generate SQL

MySQL has a set of tools that does wonders. This is just one of them by mysqldbcompare

On a Debian / Ubuntu servers, you need to install mysql-python-connector and mysql-utilities and the following command will generate a difference SQL for the first database.

mysqldbcompare --server1=user:pass@localhost \
--server2=user:pass@localhost db_old:db-new \
-a --difftype=sql --changes-for=server1 \
--skip-data-check > diff.sql

Leave a Reply

Your email address will not be published.