Been "slaving" on this issue all day.
I have a master/slave setup that works, but when I try to replicate to a different database name on the slave it fails. This is what my.cnf looks like:
server-id=101 report-host=Slave01 replicate_do_db='DB1' replicate-rewrite-db=DB1->DB2 replicate-ignore-table=DB2.SOME_TABLE_NAME
If I take out the replicate-rewrite-db line, it works perfectly and replicates the DB1 database from the master to the slave. The master log position I am using on the slave is after the CREATE DATABASE DB1 call on the master. After that log position, the tables are created and data imported on the master. I don't configure and start the slave until after I create the DB2 database.
Update: Saw this in the mysql error log:
120531 15:48:19 [Note] Slave I/O thread: connected to master 'slave_user@master_server:3306', replication started in log 'mysql-bin.000001' at position 107 120531 15:48:20 [ERROR] Slave: Error 'Unknown database 'DB1'' on query. Default database: 'DB1'. Query: 'CREATE TABLE `ANOTHER_TABLE` (