Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to setup MySQL replication so that CREATE TABLE and ALTER TABLE statements get replicated but INSERT, DELETE and UPDATE statements do not?

I've got replication working fine and have several tables that are ignored as per the requirements. But we have a requirement that the slaves have an empty copy of the ignored table. We create those empty copies before we start replicating. Since the table is ignored, table structure changes don't get passed down from the master to the slave's empty copy.

I know it's a strange requirement.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

i'm afraid you cannot get it done with the built-in mysql replication.

but.. you can still use it and have some cron job that finds alter-statements in the master's binlog and applies them to the slave.

share|improve this answer
    
I didn't think so. But the cron job is a great idea. I'll have to see what I can do with that. –  Ed Manet Oct 4 '12 at 17:14
    
use mysqlbinlog to parse the last logs; 'wite down' name of last parsed file and at the beginning of your cron script force creation of a new log by running "flush logs" –  pQd Oct 4 '12 at 17:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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