You can back up Mysql Data in either of the following ways:
1) copy files. This is of course the simplest. Copy the folder of the corresponding database and then copy the file ibdata1.
2) mysqldump
Of course, the 2nd methods are better. For example, if I back up the database mydb, the steps are as follows:
MySQL/bin> mysqldump mydb> mydb. SQL
First, create a database in MySQL;
Create Database mydb;
Then Import mydb. SQL:
MySQL/bin> MySQL mydb <mydb. SQL
The error message is as follows:
Error 1005 (hy000) at line 12: Can't create table './mydb/Foo. frm' (errno: 150)
This is because the table has foreign key constraints.
......
I am not familiar with the database. As a result, Google and Baidu haven't seen a guide for database cainiao for half a day. Now, I have solved the problem and made a contribution to everyone: I am not talking nonsense :) the solution is:
Before restoring data,
Set foreign_key_checks = 0;
Set it back after recovery:
Set foreign_key_checks = 1
Click OK.