2 way sync of MySQL databases - mysql

A web application runs both on live and local server with live and local database server. Users use live server to add the data, whereas internal staffs use the local application to update the data. After some time, both of these databases have to be synchronized properly without loss of data from live or local database server. I don't want an exact replica of live database in local database or vice-versa but databases need to synchronize values which have been entered in it.

Related

How to sync and merge local MySQL db with server MySQL db?

I have an app with a MySQL db running on a local network and I need to host it online. I need to work on the local version of the app on the local network and the server version outside the network.
I need the data to be consistent where the db is the same locally and on the server. Assume the same fields will not change on both (no merge conflict) and that sync and merge can take place once everyday - at the end of the day. Data may change on the local version, server version or both, that's why I need a merge. I've seen many other posts but couldn't find a clear solution.
How is that possible?

What is the best way to two way sync MYSQL remote and local databases

I have a situation wherein I want to sync remote and local MYSQL databases.
Local DB is connected to local application and remote DB is connected to remote application.
So records in both DB get updated or inserted separately.
Database schema is same.
What is the best option to keep both databases in sync?

How to merge local and remote databases?

I am working with a live site that is dependent on a database (which I have access to). I have copied the site locally and am running it with MAMP. All of the files from the server are version-controlled using git, so the files on my localhost are always up to date with the ones on the server.
However, the database doesn't work as well as the files. To merge the changes from the live database I have to export it as a .sql file, then import it into my localhost. However, if the local database changes, those aren't reflected when I re-import. How can I merge the changes so that I keep my local database updates, but "pull" the remote changes so it is up to date?
Well, you have multiple options here.
You can use FEDERATED Storage Engine and can query the remote database locally. FEDERATED Storage Engine is kind of same as Linked Server in MS SQL Server
You can as well set up Replication between the servers (Transactional Replication). In which case, depending on the setup data from primary will get synced with the secondary server; if not instantly but over a period of time.
You can as well User MySQL BackUp and Restore procedure. I mean specifically, Differential/Incremental Backup

data replication and master

I have a web based system in php that works locally in multiple places and in each place has a local database in mysqli.
Also my system in every place connect remotely to another database that get all of information from specific tables of local systems as an example when you insert a record in any place,this record insert to remote database ,too. and so on ,to tell summary sync information from local to remote database.
schema of the system
Now I know replication can be a good idea for this.
but I don't know when my remote database has a problem and my system can't connected to remote database how to apply changes in local database to remote database?

Replicate my local database (Mysql) to remote database( phpmyadmin)

My MySQL database (local server) is connected to a weather station. The data are updated continuously on my local server. My idea is to develop a web application that allows me to access this data.
My local database (MySQL) has to be replicated on a remote server (phpmyadmin)
The architecture is as follows:
My questions are:
1- How I do the connection ? I know that I can import my cvs file manually but I don't want to do this.
2- Can I update the datas automatically in my remote server ?
NOTE: I only want to queries on my remote server (phpmyadmin), I will not create or modify new datas.
Thanks you for your help.
As i understood, you want to make a copy of your local mysql data on a remote server.
first of all phpmyadmin is a tool or webapp to access mysql , it is not a server itself.
and second
there are two type of replication approach
Master-slave (read from slave , write to master, that will sync to slave)
How to do it
Master- Master (whatever operation are on master that will also replicate on other master) How to do it (Master-Master replication is deprecated. See Group Replication as a replacement)
You can choose the approach as per your requirement
Master-master vs master-slave database architecture?
How to achieve replication
http://dev.mysql.com/doc/refman/5.7/en/replication-howto.html