Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a slave database that bears a different name than it's production counterpart. (We are using the replicate-rewrite-db option.)

When I run a mysqldump from the slave (which I do for making dev copies), two of the database views have the database name attached to them. I cannot use the dump file to create another copy without manually editing it.

If I run the same mysqldump from the production copy, everything comes out clean. So for some reason the slave has created these two views incorrectly. (The other four views were created before replication was established, which I believe explains the difference. I have confirmed replication is in sync.)

Snippet of the mysqldump from the slave:

/*!50001 VIEW `database_slave`.`view_company` AS select `database`.`company`.`id` AS `id`,
         `database`.`company`.`name` AS `name`,`database`.`company`.`state` AS `state`,

Same snippet of the mysqldump, but from production (nice and clean):

/*!50001 VIEW `view_company` AS select `company`.`id` AS `id`,
         `company`.`name` AS `name`,`company`.`state` AS `state`,

Can I fix this without having to dump from prod to the slave?

share|improve this question

Looks like you've hit mysql bug: Consider upgrading mysql to recent 5.1.X version.

share|improve this answer
up vote 0 down vote accepted

The root of the issue I was having was because of the replicate-rewrite-db option in use. Replication preserves the name of the database inside the views, so replicating to a database with a different name causes this problem.

We have since eliminated use of the replicate-rewrite-db option, having determined for this and other reasons that replicate-rewrite-db is a JBYCDMYS option (Just Because You Can, Doesn't Mean You Should).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.