Mysql – How to Sync and Consolidate Data from Multiple MYSQL local database to MYSQL live server database in PHP

MySQLPHP

Mysql Server Data Consolidation

What I want to accomplish is that the web app will still work without internet connections, which means that the branch will still operate without internet connections. If there is an internet connection the local servers will automatically upload the data to the live server.

The local server will send the data to the live server considering no data duplicates from the other branches' local server. The job of the Live server is to consolidate all the data coming from those local servers.

Additional info:

Each office branch has its database and only the Central Database has a copy of all the branches' data. The main function of the Branch Office is to upload new data they have if the internet connection is okay.

Central Server and the Client-Server have the same database schema. The problem is the loss of data or accuracy of data when they have the same primary key especially when the branches are all uploading data at the same time.

I am using Mysql Version 8.

Best Answer