Mysql – How to sync two databases (alternative to thesql replication)

MySQL

Hello i have 2 mysql databases where most of the structure is constant except few tables (additions) in 2 dbs. I need to synchronize these 2 databases mainly common tables from one db to another. This is only 1 way.

I cannot use replication here because my databases are not same. I need to take the changes from db1 and then sync into db2 and this needs to happen in real time. Are there any tools or scripts available on linux which does this or do we need to write custom scripts? If custom scripts, any suggestions would be helpful.

Best Answer

mysqldbcompare, part of mysql utils, can check differences in structure and data among two servers. However, if you are making updates to one of the servers at the same time, this may not be enough.

pt-table-checksum and pt-table-sync, from Percona Toolkit, can respectively check and synchronise differences in data between a master and a slave in real time. It doesn't matter if both servers have different data, but it requires having the same tables with the same definition.

So probably you can use a combination of both. Both MySQL utils and Percona Toolkit are open source, freely downloadable and well established utilities among MySQL DBAs.