1

I have a production database called "master" that I want to replicate on another server under another name (call it "slave").

All worked fine until an ALTER TABLE statement was performed on the master server. Since then, the replication hung up and I get this error in the slave log:

[ERROR] Slave SQL: Error 'Table 'master.students' doesn't exist' on query. Default database: ''. Query: 'ALTER TABLE `master`.`students`

Well of course it does not exists since I told MySQL to rename "master" to "slave"! But it seems like MySQL decided not to rename the database in ALTER TABLE statements.

Here is an excerpt from my slave config.

server-id = 2
relay-log = /var/log/mysql/mysql-relay-bin.log
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = slave
replicate-rewrite-db="master->slave"
asked Jun 4, 2015 at 10:44
1
  • Did you have a USE statement before it? Consider writing a bug at bugs.mysql.com Commented Jun 9, 2015 at 0:37

1 Answer 1

1

It turns out I was using MySQL Workbench and it does not output a "USE" statement in its DDL update scripts, also rewriting does not occur if you do not provide a use statement.
So adding USE master; at the beginning of the script fixed it. Thanks!

answered Jun 11, 2015 at 12:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.