Difference between MySQL databases

  • camperjohn
  • Guru
  • Guru
  • User avatar
  • Posts: 1127
  • Loc: San Diego

Post 3+ Months Ago

Does anyone have ideas on how to do a difference between databases?

For example, I have 50 tables in a database on some software that I bought. I want to take a snapshot of the database, upload a photo, edit a gallery, then take another snapshot of the database to see what changed.

Any ideas on how to do that?

> mysql databaseB - databaseA

?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

It seems like all of the pieces of software out there which do this either want you to jump through a bunch of registration hoops, or download a whole suite of tools and spend awhile figuring out which one you actually need. :scratchhead:

--

My first thought is to use mysqldump to export the database snapshots, and then use "diff -minimal a.sql b.sql" to find the differences.

Code: [ Select ]
mysqldump -uuser -ppassword test > a.sql
# do some stuff
mysqldump -uuser -ppassword test > b.sql
  1. mysqldump -uuser -ppassword test > a.sql
  2. # do some stuff
  3. mysqldump -uuser -ppassword test > b.sql


That diff will give you output like this though, which I'm guessing isn't going to be the easiest thing to decipher with a real data set. I suppose it's possible though.

Code: [ Select ]
joebert@sr1123wm:/tmp$ diff -d a b
37c37
< INSERT INTO `one` VALUES (123,122),(1,4);
---
> INSERT INTO `one` VALUES (123,122),(1,4),(123,122);
77c77
< -- Dump completed on 2010-05-13 22:28:48
---
> -- Dump completed on 2010-05-13 22:28:59
  1. joebert@sr1123wm:/tmp$ diff -d a b
  2. 37c37
  3. < INSERT INTO `one` VALUES (123,122),(1,4);
  4. ---
  5. > INSERT INTO `one` VALUES (123,122),(1,4),(123,122);
  6. 77c77
  7. < -- Dump completed on 2010-05-13 22:28:48
  8. ---
  9. > -- Dump completed on 2010-05-13 22:28:59


Which if you just want to know which tables changed, those hex offsets could be traced back to the CREATE TABLE statements in b.sql to find out which table changed.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 112 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.