0

There are 2 copies of the same database on 2 different storages which need to be in sync.

For example, database named test_db contains tables T1,T2,T3 tables. T2,T3 are deleted. Dump of the 1st copy is created using:

mysqldump --login-path=lp --add-drop-table test_db > dump.sql

and imported on 2nd storage using:

mysql --login-path=kp test_db < dump.sql

But deletion of tables T2,T3 on the 1st storage is not propagated this way to the 2nd storage.

How to propagate deletion of tables from the 1st storage to 2nd storage using mysqldump on the 1st and import of the dump on the 2nd?

2
  • Is Replication involved?
    – Rick James
    Commented May 16, 2018 at 16:39
  • no, it's single server installation Commented May 19, 2018 at 13:33

1 Answer 1

1

You need to drop and re-create the database. So you need to use some extra / different options when creating the dump file:

mysqldump --login-path=lp --add-drop-database --databases test_db > dump.sql

And import with:

mysql --login-path=kp < dump.sql

Your Answer

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

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