John Arzaga
John Arzaga

Reputation: 103

Synchronize MySQL with updated Data only

Hello guyz I am trying to synchronize 2 database from my localhost and hosting. but with the condition that only last changed record will be updated for both local and hosted.

Example

Local:

column1 column2 column3 column4 column5
Data1r1 Data2r1 Data3r1         Data5r1
Data1r2         Data1r2 Data1r2 Data1r2 

Hosted:

column1 column2 column3 column4 column5
Data1r1         Data3r1 Data4r1 
Data1r2 Data1r2 Data1r2 Data1r2 

After filling up the missing data, both local and hosted will be like this

column1 column2 column3 column4 column5
Data1r1 Data2r1 Data3r1 Data4r1 Data5r1
Data1r2 Data1r2 Data1r2 Data1r2 Data1r2 

Question: What is the easiest and best way to do it? Thank you for the help!

Upvotes: 0

Views: 56

Answers (1)

NIKUNJ KOTHIYA
NIKUNJ KOTHIYA

Reputation: 2165

I think there are many ways to do this.

  1. First way is when data is change in particular table at that you can set a api call or event from localhost to hosted DB with that updated data and edit the data based on id of that table row.

  2. There is another way of doing this by cron job in regualar interval from localhost to hosted DB and vice versa.

Upvotes: 1

Related Questions