Practical exercise | MySQL data synchronization using Navicat

In the previous article, we introduced the use of Navicat for MySQL structure synchronization . Generally, in the case of database migration, database upgrade, and database maintenance, there is often a need to synchronize the database structure.

Data synchronization is also one of the most routine operations in database management development, which refers to synchronizing data in the database between different database servers to ensure data consistency. It can help enterprises ensure data consistency between multiple database servers, so that changes on one server can be synchronized to other servers in a timely manner.

Scenarios for general data synchronization operations include:

  1. database migration
  2. Database server failure
  3. database backup
  4. database upgrade
  5. database maintenance

Today, we practice the operation of MySQL data synchronization, so that everyone can more intuitively understand how Navicat can conveniently and quickly synchronize data. If you want to learn while using, welcome to click  here to download the free full-featured trial version of Navicat Premium.

Here we suggest that structure synchronization needs to be completed before data synchronization, because data synchronization is performed on the basis of the same structure .

1. Open the "Data Synchronization" window in Tools -> Data Synchronization.

2. Similarly, first select the connected database of the source and target. In addition, data synchronization supports data synchronization operations between databases of the same type.

3. In the options at the bottom, you can choose to set the operations on the target table in data synchronization.

"Insert Record": Inserts a record if it does not exist in the target table.

"Delete Records": Delete redundant records from the target.

"update record": If the record in the target is different from the record in the source, update the record.

4. After setting the options, click Next to enter the table or collection mapping window. In the list here, only tables or collections with the same name in the source and target will be mapped in the list, and if there are keys or fields with the same name, they will also be displayed (mapped) in the list. If you do not want to synchronize some tables, uncheck the corresponding tables in the list.

5. There are two options at the bottom, "Compare & Preview" and "Compare & Deploy".

"Compare & Preview": You can view the comparison results before the synchronization starts, and you can reselect whether to perform operations on the corresponding tables.

"Compare & Deploy": After the comparison, there is no preview of the comparison results, and the deployment (synchronization) is performed directly.

6. Select "Compare & Preview" here to enter the interface for viewing the comparison results.

7. After comparing the data, the window displays the number of records of the corresponding table that will be inserted, updated or deleted in the target.

8. When clicking an option in the above list, the bottom pane will display the data in the corresponding source and target. Values ​​that differ between source and target are highlighted. To view data for multiple rows, right-click the grid and select Show Secondary Viewer. You can uncheck the records you don't want to apply to the target.

9. The bottom window can also choose to display records of different operations (insert/update/delete/same etc.).

10. If you do not want to synchronize the data, you can uncheck the check box.

11. After selection, click Next to display scripts for all selected tables or collections and records. You can view all scripts that will be run in the target database in the "Deployment Scripts" tab.

12. Click the deployment option at the bottom, and the operations that can be performed during the relevant deployment will pop up.

"Continue on error": Ignores errors encountered during the running process, if desired.

"Run multiple queries per run": Run multiple SQL statements at once, which will make the transfer process faster.

"Use Transactions": Rollback all data when an error occurs.

13. Click the button on the right side of the deployment option at the bottom to choose to edit the script, and click the arrow at the bottom to reorder each script statement.

14. After completing all settings, click "Start" to synchronize data.

15. After the synchronization is complete, you can also click Save Configuration File to save the settings of this data synchronization.

Summarize

Database data synchronization is usually performed by a database administrator or database engineer. They can formulate a database data synchronization plan according to the needs of the enterprise, and implement related operations to ensure the consistency of the database data. Navicat's data synchronization feature is available for MySQL, Oracle, PostgreSQL, SQL Server, MariaDB, SQLite and MongoDB. Both Navicat Premium and Navicat for MySQL support synchronization between MySQL and MariaDB. If you have other technical questions, please feel free to contact us.

Past review 

  1. Navicat now officially supports Redis
  2. Navicat 16 supports OceanBase full-line database
  3. Recruit Navicat Monitor 3.0 monitoring tool experience officer |
  4. Nanny level tutorial | Navicat manual backup and automatic backup
  5. Navicat was selected into the "China Database Industry Map" released by the China Academy of Information and Communications Technology in 2023
  6. Navicat's 20-year development history | Founded in Hong Kong, China in 1999
  7. The interactive gift event is in progress | The prize is Navicat Premium worth 819 yuan
  8. Fake websites cause multiple security risks | Official solemn statement: Do not buy or download Navicat software from unofficial channels

Guess you like

Origin blog.csdn.net/weixin_53935287/article/details/131830261