2

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?

2 Answers 2

0

Looks like you've hit mysql bug: http://bugs.mysql.com/bug.php?id=40345 Consider upgrading mysql to recent 5.1.X version.

0

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .