Backup and restore steps for Mysql-front database

Source: Internet
Author: User
Tags create database

1. Backing Up the database

After the MySQL database is established, we need to back up the database frequently to ensure that the data can be recovered to the maximum extent after loss. There are many ways to back up your database, and now there are tools dedicated to backing up MySQL data, such as the Empire backup King. However, the most commonly used backup method is to export the MySQL order database to SQL files, with the suffix ". sql", and the SQL file as the SQL script file.
In Mysql-front, you can export an entire database as an SQL file or other type of file, or you can export a table separately to a SQL file or other type of file, exporting by right-clicking on the database or table you want to export → Select the exported file type.

Figure: Exporting database operations

Figure: Export Database _ Save as File

Figure: Backup options
When a database is backed up, you are asked to select the relevant backup option, as shown in figure (6-16), which is briefly described below:
(1), export content: There are two options. structure is the creation of the database, the structure of the table, and the data is the specific data in the table.
(2), options: There are three major items.
(a), "database" includes "CREATE Database" and "list Database". The CREATE DATABASE Database name statement is available in the exported code, when you select????. Select "List Database" to have the "use ' database name ' in the exported code;" Statement.
(b), "Existing data" includes "delete previously created", "Replace", "expand include query" three items. The "Existing data" option is used to control how the restored data coexists with existing data when the database is restored. If "Delete previous creation" is deleted, the "database with the same name" or "table of the same name under the same name" is deleted from the server at restore time. Therefore, before restoring the database, be sure to back up the original database, so as not to cause the loss of the database.
(c), "Information" is a number of other relevant information.
When the database is backed up as a SQL file, pay attention to the name of the file, we usually back up the database more than once every day, so in order to find convenient later, good naming is necessary. Generally speaking, we take the form of "database name + year Date", such as: Mydatebase_20120325.sql.

2. Restore the database

After a database backup, you can restore the backup SQL files to the server, before restoring the database, be sure to back up the original database, so as not to cause the loss of the database. The way to restore is to right-click on the server name → open → Select the file you want to open (typically SQL file).

Figure: Restoring Database operations

Figure: Restore Database _ Select files
Sometimes the database is incorrectly restored by this method, and the common errors are:
(1), Chinese coding problems caused by garbled. Solution: Import through the SQL Editor, right-click in the SQL Editor → paste from file.
(2), the database already exists. This error is reported if there is a "CREATE DATABASE" in the SQL code of the RESTORE database but there is no "delete previously created" code, and the database already exists at the time of the import. Solution: Deletes a database that already exists.
(3), the database does not exist. This error is reported if you do not have the "CREATE DATABASE" code in the SQL code of the restored database, and you do not currently have the database selected to be restored. Solution: If the database you want to restore to does not exist, create one, and be sure to select the database when you restore it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.