Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see the differences between 2 MySQL dumps?

I have 2 MySQL dump files. I want to find the table data difference between 2 tables.

like image 824
Tree Avatar asked Oct 01 '10 15:10

Tree


People also ask

How can I find the difference between two databases in MySQL?

Getting data differences of two MySQL databasesClick New.. on the product Start Page or New Data Comparison on the Standard toolbar to open New Data Comparison Wizard. Specify the needed connections to MySQL servers in the Connection fields. Select the databases you want to compare in the Database fields.

Where do MySQL dumps go?

Then the dump will be in the file backup-file. sql in the current directory. If you don't redirect then the output will just be displayed to the screen, not saved to a file.


2 Answers

run mysqldump with "--skip-opt" to get the 2 dumps files i.e:

mysqldump --skip-opt -u $MY_USER -p$MY_PASS mydb1 > /tmp/dump1.sql  mysqldump --skip-opt -u $MY_USER -p$MY_PASS mydb2 > /tmp/dump2.sql 

compare using these diff options:

diff -y --suppress-common-lines /tmp/dump1 /tmp/dump2 
like image 72
Fabio Pedrazzoli Grazioli Avatar answered Oct 20 '22 18:10

Fabio Pedrazzoli Grazioli


Use a DIFF tool - here are some graphical ones (both are free):

  • KDIFF
  • winmerge
like image 21
OMG Ponies Avatar answered Oct 20 '22 17:10

OMG Ponies