This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Replication : Table doesn't exist with replicate_rewrite_db

I've set up replication between two mariadb 10.6 servers. I want the master to replicate its DB "database" to the slave DB "database1". The goal here is to set up multi-source replication. Here's the slave configuration :

log-bin
server_id=2
master1.replicate_rewrite_db="database->database1"

I can start the slave with :

CHANGE MASTER 'master1' TO MASTER_HOST='XXXX', MASTER_USER='replication', MASTER_PASSWORD='XXXXXXX', MASTER_PORT=3306, MASTER_LOG_FILE='master1-bin.000001', MASTER_LOG_POS=710, MASTER_CONNECT_RETRY=10, MASTER_USE_GTID = slave_pos;
SET GLOBAL gtid_slave_pos = "1-1-2"

If I add a new table to the master, the table is replicated to the slave. However, if I populate the new table with data, the slave gives the following error :

show slave 'master1' status \G;
...
Last_SQL_Error: Error 'Table 'database.test' doesn't exist' on query. Default database: 'database1'. Query: 'INSERT INTO `database`.`test` (`test`) VALUES ('1242')'
...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.