![]() |
Comparing/Diff-ing MySQL Tables
What are the best tools to do it? I need this badly.
A few days ago some very bad shit happened to my mysql databases. Fortunately I had backups and only 1 day was lost. However, I realized that having something to do diff on tables would be very helpful. I can compare raw dumps using text editors and comparison tools but that's not a really cool way to do it. I would be very grateful for any tips and suggestions. :helpme |
you don't need any "tool", just run a query using the 2 tables...
most straight forward way is probably to "LEFT JOIN" on id fields on the 2 tables and then search for "table2.id IS NULL" that will find any missing rows... |
run mysqldump with "--skip-opt" to get the 2 dumps files i.e:
Code:
mysqldump --skip-opt -u $MY_USER -p$MY_PASS mydb1 > /tmp/dump1.sql Code:
diff -y --suppress-common-lines /tmp/dump1 /tmp/dump2 Interesting thread you would have to try and see ... see: $ man diff |
All times are GMT -7. The time now is 01:19 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123