r/mysql • u/SuddenlyCaralho • Jul 18 '25
question Is there a way to replicate two databases from two different MySQL servers into a single MySQL server?
Is there a way to replicate two databases from two different MySQL servers into a single MySQL server?
I have:
Server A: DB01
Server B: DB02
I want to replicate both databases into Server C.
I don't want to create multiples instances inside server C. I want one instance with two databases: DB01 and DB02. I'd like to replicate using master-slave setup.
4
Upvotes
9
u/tobakist Jul 18 '25
Yes, it's called multi source replication, we've been using it for a few years for reporting etc
https://dev.mysql.com/doc/refman/8.4/en/replication-multi-source.html
1
u/Temporary_Practice_2 Jul 19 '25
Step by step: https://chatgpt.com/share/687b7bbd-59bc-800e-9c1e-b9fb35aa3baa
1
u/CESDatabaseDev Jul 19 '25
Whats the size of your databases?
1
u/Brad_from_Wisconsin Jul 20 '25
yes there is a way to do that. There are several ways.
0
u/roXplosion Jul 18 '25
Federated tables?
0
u/AshleyJSheridan Jul 18 '25
Yes, and actually it's how you want replication to be done (at least in terms of one DB replicating to another on a different server). If they're both on the same server, then a lot of the advantages of replication are lost.
There is a caveat though. If you're replicating databases from 2 different servers onto a third, they all need to be running the same version of MySQL/Maria. You will run into problems if you try to replicate onto different versions (if you can get it working at all).
-2
u/CESDatabaseDev Jul 18 '25
Why do you need replication?