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