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
1 Answer 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.
Explore related questions
See similar questions with these tags.