Abstract

When we want to do risky operations on the database, we need to back up the database. Every time we go online, there will always be inconsistency between the online and offline database structures. This article will explain how to use Navicat to conveniently solve these two problems.

Navicat

Navicat is a fast and reliable database management tool designed to simplify database management and reduce system administration costs. It is designed to meet the needs of database administrators, developers, and small and medium-sized enterprises. Navicat is built with an intuitive graphical user interface that allows you to create, organize, access, and share information in a secure and simple way.

Note: this tutorial Navicat12 version, the download address: www.navicat.com.cn/download/na…

Introduction to the Database

There are now two databases in the database, mall-test for the test environment database and mall-prod for the online environment database.

The data backup

Now let’s take a backup of the mall-test database. After the backup is complete, delete the commodity table data, and then use the backup to restore the data.

An overview of the data in mall-test

At present, only the database table of commodity module is in the database, and there is certain data in the PMS_product table.

Backing up data

  • First click the backup icon on the top toolbar, and then click the New Backup button

  • Click the Start button to start the backup

  • After the backup is complete, a backup file is generated

Clear the data in the PMS_product table

Restore data from a backup

Structure of synchronization

Related background

There was only the table of commodity module in the original mall-test module. Now, after a period of development, we have added the order module and deleted and modified some tables of commodity module, while the original commodity module table is still in the mall-Prod table. All we need to do now is synchronize the database table structure of mall-test to mall-prod.

Structural synchronization

  • Select the structure synchronization function

  • Select the source and target databases and click the Compare button

  • You can see modified, added, and deleted tables, and click Deploy to see a preview of the SQL script

  • After confirming the deployment script information, click Run to synchronize the data structure

  • When the structure is synchronized again, the two database structures are exactly the same

The public,

Mall project full set of learning tutorials serialized, attention to the public number the first time access.