Copy MySQL database A to another MySQL database B (only for INNODB database engine)

Source: Internet
Author: User

Scenario One: (Don't change too much My.ini file)

    1. Copy the database from the original database a ib_logfile1 ib_logfile0 ibdata1;

    2. Close the destination database B;

    3. Backup destination database b ib_logfile1 ib_logfile0 ibdata1 three files to prevent the database from being used after the change;

    4. Copy to the original database a ib_logfile1 ib_logfile0 ibdata1 placed in the destination database b corresponding location, if your destination database ib_logfile Two files size and copy to the same file size, paste directly can;

    5. Restart database b

Scenario Two: (Need to change My.ini file)

    1. Copy the database from the original database a ib_logfile1 ib_logfile0 ibdata1;

    2. Close the destination database B;

    3. If the size of the Ib_logfile two files in database B is different from the size of the copy file, the Ib_logfile1 Ib_logfile0 ibdata1 three files in database B of the backup destination, prevent the database from being used after the change, and delete the I under the destination database.     B_logfile1 the Ib_logfile0 file, change the innodb_log_file_size in the My.ini file to the Ib_logfile1 ib_logfile0 file size in the original database eg. innodb_log_file_size=90m;

    4. Restart database B;
      After success, delete Ib_logfile1 ib_logfile0 that restarted database B, paste the copy ib_logfile1 ib_logfile0 (or replace the existing database with copy's Ib_logfile1 IB_LOGFILE0). b in the Ib_logfile1 IB_LOGFILE0 can be);

    5. Paste the database ibdata1 to the appropriate location;
      Restart database b

PS: The purpose is to ensure
1, database Ib_logfile1 IB_LOGFILE0 ibdata1; must be copied at the same time, that is, you can not copy the process of other operations to manipulate the database you want to copy. (The data copied may have crash)

Transferred from: http://my.oschina.net/u/1462678/blog/223646

Copy MySQL database A to another MySQL database B (only for INNODB database engine)

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.