Mysql – Realtime Update MySQL on every Update occurred on PostgreSQL

functionsMySQLpostgresqlscripting

I have a PostgreSQL for my accounting system and a MySQL database for my php website, i want to sync these two database for every update may occurred on PostgreSQL it also updates MySQL database, they are on linux operating system(ubuntu),

How can i do this work?

Best Answer

Two basic approaches.

1) Connect the servers via ForeignDataWrapper, DatabaseLink, Linked Server, External Table, or whatever your source system calls their technology.

2) Replication

Replication changes can be collected by triggers, or puled from database logs. High throughput systems should use a log based solution, although those usually cost money (Oracle GoldenGate, Sybase RepServer, IBM IIDR, etc). You may want to check out https://www.symmetricds.org as an open source alternative.

The downside to #1 is that your transaction success may (or will?) be dependent on BOTH systems being available. Also, you will take a performance hit to update both systems at once.