From:       To:      
Home > Documentation > PostgreSQL to MySQL

Synchronization

PostgreSQL to MySQL can do single direction database synchronization as inserting data that not exists in MySQL table and updating the destination rows with the related PostgreSQL data. For synchronization purpose source and destination tables must have identical structures and have primary key or unique index defined.

Assume both MySQL and PostgreSQL databases have table "People" defined as below:

    Table1(
        ID Integer NOT NULL, 
        FisrtName Varchar(50),
        LastName Varchar(50), 
        EMail Varchar(50), 
        Primary Key (ID)
    );

This table has the following contents in PostgreSQL database:

2  Mathew  White m.white@corporation.com
3  Phil  Johnson p.johnson@gmail.com

In MySQL database:

1  John  Smith j.smith@msn.com
2  Mathew  White m.white@yahoo.com

After synchronizing MySQL with PostgreSQL data the source table is kept untouched and the destination table is modified as follows:

1  John  Smith j.smith@msn.com
2  Mathew  White m.white@corporation.com
3  Phil  Johnson p.johnson@gmail.com

If you're looking for bi-directional incremental synchronization between MySQL and PostgreSQL, take a look at PostgreSQL-MySQL Sync tool.