6

I had to recover a database with a some months old full backup. I have however in my possession a most recent but unfortunately incomplete SQL dump for this same database done with mysqldump.

Is there any tool out there that will allow me to compare my SQL dump with the live database and import any new data?

  • When you say "possession a most recent" you mean with additional content (rows), or with modified rows? – Evan Carroll Mar 10 '18 at 19:39
1

import your dump with INSERT IGNORE OPTION (skip duplicates)

on your dump file (assuming you're using linux OS)

cat /path/dir/to/dumpfile.sql |
  sed s/"^INSERT"/"INSERT IGNORE"/g > /path/dir/to/newdump.sql

then issue import

mysql -u username -p databasename < /path/dir/to/newdump.sql
0

I guess you should import both dump's to MySQL Server, and then use

REPLACE INTO old SELECT * FROM new
0

You can Import into two tables TABLEA and TABLEB then compare the two using the following:

select * from tableA
minus
select * from tableB

If you get two result sets use

select * from tableA
except
select * from tableB
  • 1
    Do you know which versions support minus instead of except? Beyond that, this does cover the "comparison" aspect of the question, and might help someone determine if there's both new and updated records (which I don't think the answers cover the possibility of). – RDFozz Jun 8 '17 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.