Copy MySQL database A to another MySQL database B (only for innodb database _ MySQL

Source: Internet
Author: User
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)

  1. Copy the database (database) ib_logfile1 ib_logfile0 ibdata1 in the original database;

  2. Shut down the target database B;

  3. Back up the ib_logfile1 ib_logfile0 ibdata1 files in the target database B to prevent the database from being used after the change;

  4. 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;

  5. Restart database B

Solution 2: (change the my. ini file)

  1. Copy the database (database) ib_logfile1 ib_logfile0 ibdata1 in the original database;

  2. Shut down the target database B;

  3. 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;

  4. 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 );

  5. 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)

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: info-contact@alibabacloud.com 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.