C# work with the database in online and offline mode


There is a database on MySQL which is located on the hosting. It is necessary to implement the ability to work with the database locally when there is no Internet connection.

  • How to organize the copying of the database from the hosting to the local machine?
  • How to track changes in offline mode and register them in the database on the server when connected to the Internet?


If I understand correctly, you need to set up replication. Replication is a mechanism for copying data from one database to another. You can read about it for example here or here .

Depending on your settings, you can replicate the entire database, a single table, or part of it. If you need bidirectional replication, you can set two directions for data exchange in the cluster (master – master): master – slave and slave – master. Such a scheme, depending on the project, works for some for years, for others it immediately creates a number of problems. Starting with MySQL 5.1.18, the master-master feature is already officially supported, including multi-master replication, including circular ones. A source

Scroll to Top