MySQL Database Data Migration method

Source: Internet
Author: User

Description: There is no discussion of the command line and the use of tools such as Navicat , this is only discussed in the case of MySQL broken (unable to start), what to do.

Method:

A) First look at the MySQL database file situation:

MySQL is broken, whether it is Linux or Windows version, MySQL has a database file directory data directory, such as:

(Note that the Linux version above is my.cnf almost)

Then the data directory looks like this:


Through the observation can know inside a folder such as world these is a database. Entering this file is similar to the following two scenarios:

situation One:                or situation Two:

Can be guessed is a table file.

b) Look again at how to migrate these databases.

For the above scenario one, that is, the database file is. frm,. MYD,. Myi situation, this is super convenient, directly copy the database folder to the target database directory to be migrated to.

For scenario two above, that is, the database file is a. frm,. IDB case, this is handled:

i) Copy the database folder to an available MySQL database directory (hereinafter referred to as the intermediate database).

II) Stop the intermediate database, back up the intermediate database's Ibdata1 file, and then replace the Ibdata1 file.

III) add a row innodb_force_recovery=4at the end of the my.ini of the intermediate database.

IV) start the intermediate database and migrate the target database of the intermediate database to the target by means of a tool or command line.

v) Intermediate database fallback processing (that is, commenting out the innodb_force_recovery=4, fallback ibdata1 files those, does not affect the intermediate database).

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MySQL Database Data Migration method

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: 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.