Data Recovery and backup after mysql5 Windows Vista/7 system is reinstalled

Source: Internet
Author: User

Previously, we used the Vista system. Recently, we re-installed a Windows 7 system, and the system changed. We had to re-install the previous software. When installing MySQL, the original data is definitely lost. Fortunately, I copied all the files in the data folder in MySQL before I reinstalled the system.

Note that in mysql5.0, the location of the data folder is related to the operating system. In Windows XP, it is in the MySQL installation folder, which is generally in program files, windows Vista or 7 is generally stored in the programdata folder (if you cannot see it, select the folder option to remove the hidden and protected operating system files and tick the hidden files ).

 

 

Check that the ib_logfile0 and ib_logfile1 files are both log files and are not very important. The most important files are ibdata1 and. frm files in the folder. Let's talk about the general functions of these two types of files.

L. frm files are generally the structures of all tables in a database.

L The ibdata1 file is the data in the database table.

 

If you want to back up the data, I think none of these two types of files is available (if ibdata1 does not have frm files, you still remember that the table structure should be restored after you create a new table ).

 

Now let's take a look at how it is restored?

1. Stop MySQL Service

Right-click your computer and choose services and applications> services> mysql> stop

 

2. Delete the data folder in the original MySQL database

Find the MySQL folder under programdata, go to MySQL server, and delete the data folder (we recommend that you back up the folder and then delete it)

 

3. copy the data folder in the MySQL database backed up

Copy the previously backed up data folder to the MySQL server folder (do not break the original directory structure)

 

4. Exception Handling

Restart the MySQL server. If there is no error, files in the MySQL database can be recovered, including the table structure and table data. However, the following error occurs in the subsequent recovery attempts.

At first, I thought that my backup data was damaged. I tried a lot later and finally realized that it was a log file. I deleted two log files under the data folder, it should be OK to restart the MySQL server.

5. Recovery successful

 

There are several suggestions for MySQL database development:

1. Make sure to back up the data folder in the MySQL database before reinstalling the system;

2. Make sure to back up the database used during each project. It is best to generate an SQL file and put it under the project;

Reprint please provide source (http://www.blogjava.net/lishunli/archive/2010/01/09/308845.html), thank you.

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.