Copy MySQL database A to another MySQL database B (only for the innodb database engine) Solution 1: (do not change too much my. ini file)
Copy the database (database) ib_logfile1 ib_logfile0 ibdata1 in the original database;
Shut down the target database B;
Back up the ib_logfile1 ib_logfile0 ibdata1 files in the target database B to prevent the database from being used after the change;
Place ib_logfile1 ib_logfile0 ibdata1 in the source database A in the corresponding location of the target database B. If the size of the ib_logfile files in the target database is the same as that in the copy, paste it directly;
Restart database B
Solution 2: (change the my. ini file)
Copy the database (database) ib_logfile1 ib_logfile0 ibdata1 in the original database;
Shut down the target database B;
If the size of the ib_logfile files in your target database B is different from that in copy, back up the ib_logfile1 ib_logfile0 ibdata1 files in the target database B to prevent the database from being used after the change, delete the ib_logfile1 ib_logfile0 file in the target database and change my. the innodb_log_file_size in The ini file is the size of the ib_logfile1 ib_logfile0 file in the original database. innodb_log_file_size = 90 M;
Restart database B;
After the operation is successful, delete ib_logfile1 ib_logfile0 of database B and paste ib_logfile1 ib_logfile0 from copy (or replace ib_logfile1 ib_logfile0 in database B with ib_logfile1 ib_logfile0 in copy );
Paste database ibdata1 to the corresponding location;
Restart database B
PS: to ensure
1. database ib_logfile1 ib_logfile0 ibdata1; must be copied at the same time. that is to say, you cannot perform other operations on the database to be copied during the copy process. (Crash may exist in the copied data)