« August 2010 | Main | December 2010 »

November 2, 2010

MySQL replication gotchas in /etc/my.cnf

If you're doing selective replication with MySQL (telling a slave to ignore some of the updates being sent from the master), you might have a line in your /etc/my.cnf file that looks like this:
replicate-wild-do-table=database.%
Now, if you wanted to get more than one database, you need to list each one. The working show slave info would reflect this
    Replicate_Wild_Do_Table: database1.%,database2.%
but you cannot list the databases in /etc/my.cnf that way! You must list them on separate lines, or the Replicate_wild_do_table doesn't get set properly:
RIGHT WRONG
replicate-wild-do-table=database1.%
replicate-wild-do-table=database2.%
replicate-wild-do-table=database1.%,database2.%