I have data replication setup on MySQL. If I delete data on the master, will replication know data was deleted and automatically delete the same data on slave?
1 Answer
Yes, it will automatic apply the delete on the slave, with some restrictions:
- If you have
replicate-do-db=db_name
enabled, it will automatically filter out the statements to the given database names - If you have
replicate-ignore-db=db_name
enabled, it will automatically filter out statements to the given table names
-
pardon my ignorance but how do I check if those two settings are enabled? Also, what does "delete just the statements" mean? Is that the equivalent of deleting the data? I'm not really understanding the difference between the two restrictions...– PLuiCommented Apr 2, 2013 at 13:46
-
1to check run
SHOW VARIABLES LIKE '%replicate%';
if you have replicate-do-db it will replicate statements(queries) just to db that you specify in this field. if you have replicate-ignore-db it will replicate statements(queries) to dbs that isn't in this option, if you don't have anything in this 2 options it will replicate everything. Commented Apr 2, 2013 at 13:53 -
2There are also
replicate-do-table
/replicate-ignore-table
. Here are some more descriptions of what they do. Commented Apr 2, 2013 at 14:42