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 set the Master DB Name as MDB and in the Slave server I set to replicate-do-db=SDB, but this did not work. But when I set it up as the same DB name it works. Is there any solution out there to setup one master db with two different slaves but in the same server?

share|improve this question
up vote 1 down vote accepted

Your question appears somewhat muddled, as you appear to be talking about two completely different things.

  1. Master and slave replicating a database with a different name - Won't work, as the database name is the identifier.
  2. Having a master and one or more slaves on the same machine - No problem, just run them on different ports.
share|improve this answer
Although I believe the poster wasn't asking this, you can rewrite the database name while replicating. i.e. Master:db1->Slave:db2. Use --replicate-rewrite-db for this. See:… – Martijn Heemels Dec 24 '09 at 12:34

MySQL replication is per-server not per database.

Database is just a catalogue of related tables; it should not be considered anything more. Replication always replicates the database name as well as the table name.

You can replicate from one server to another on the same host (running multiple mysql instances is no problem).

You cannot, and should not want to, replicate to a different catalogue within the same server.

share|improve this answer

Slaves must be identical to their masters. A slave database is intended to appear on a different server. If you wish for a slave to appear in the same server box as the master you may want to consider visualization. However, I doubt visualizing a slave db is an efficient idea. If visualization is looking attractive you may want to reconsider your server layout.

share|improve this answer

This direct from the documentation.

replicate-rewrite-db=slavedb->masterdb I know this works I just set it up and it's working

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.