Contact MySQL |
Login | Register
Just a note on replicating QUALIFIED statements.Because I'm lazy and never select db's before running a query, I use qualified statements for ALL my queries. ie:Instead of:USE foofar;INSERT INTO fling VALUES( 'w00t' );I do:INSERT INTO foofar.fling VALUES( 'w00t' );This was a problem when I went to set up replication. After much research, I found the solution (works with 4 and up):In your MASTER my.cnf file, DO NOT put any 'binlog-ignore-db' or 'do-db' options. Any db's you wish to not replicate will be handled in the slave conf file ..In your SLAVE my.cnf file, use a 'replicate-ignore-db=<db>' for all the databases from the master you wish to stop from replicating to the slave.For all the db's you DO wish to replicate, use a 'replicate-wild-do-table=<db>.%' line.You end up with a lot of extraneous binlog data for those tables you previously set to ignore in the master conf, but it saves you having to go through all your code and add 'use database' functionality
I believe the comment immediately above ONLY applies to Statement based replication. Row based should work fine with db.qualified queries.