0

I have two database on two different hosts:

  • host A has database A and table A
    • table A contains records with primary key 1 to 10
  • host B has database B and table B
    • table B contains records with primary key 1 to 5

Now I have to take a diff of the two separate host/databases/tables i.e. "host A/database A/table A" contains 1-10 and "host B/database B/table B" contains 1-5 so records 6-10 are missing in host B/database B/table B. Now add these diff records into "host B/database B/table B" from "host A/database A/table A".

In short, update development database with new production data since last update.

What I have tried:

mysqldump --replace --complete-insert --skip-disable-keys --no-create-info -h A
 --port=3306 -u A --password=A database_A table_A 
 | mysql -h B -u B --password=B database_B
Paul White
95.3k30 gold badges439 silver badges689 bronze badges
asked Feb 18, 2016 at 12:39

1 Answer 1

1
mysqldump --insert-ignore --extended-insert=FALSE --complete-insert 
 --skip-disable-keys --no-create-info -h A --port=3306 -u A 
 --password=A database_A table_A | mysql -h B -u B --password=B database_B

--insert-ignore eventually worked as diff and made the rows unique while dumping data across database.

Paul White
95.3k30 gold badges439 silver badges689 bronze badges
answered Feb 19, 2016 at 8:17
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.