HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMajor

Replicate tables to different database name

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
replicatetablesdatabasedifferentname

Problem

Our QA environment has all it's database names suffixed with "test". For example dbname1 in production would have a counterpart dbname1test in QA. (This is largely to help protect against prod/qa configs getting mixed up).

There are a handful of tables I would like to replicate the actual production tables into QA. I'm not sure how I would go about telling it to say "replicate from dbname1 there to dbname1test there"

Is this even possible?

Solution

Yes, there is. Put this in your my.cnf file:

replicate-rewrite-db="dbname1->dbname1test"


See Replica Server Options and Variables: replicate-rewrite-db

Code Snippets

replicate-rewrite-db="dbname1->dbname1test"

Context

StackExchange Database Administrators Q#5884, answer score: 21

Revisions (0)

No revisions yet.