How to restore Mysql Data after reinstalling the system

Source: Internet
Author: User

I originally installed MySQL on the d disk. The system has been reinstalled recently and cannot be used. What should I do? How can I continue using MySQL and transfer the original data to the newly installed MySQL?
1. copy the data folder in the original MySQL installation directory;
2. Uninstall the original MySQL instance;
3. reinstall MySQL;

4. In the copied data folder, all subfolders except MySQL and test are databases, as shown in. Europa, outman, sd1004db, and shtarena are all databases;

5. Create the above database in the newly installed MySQL; I have now created the Europa database;
6. copy the files in the above Europa folder to the Europa folder under the newly installed MySQL directory;
7. When you use the Europa database, a table is displayed;

You can search for this table, and the system prompts that the table does not exist.

8. After the MySQL service is restarted, the problem persists;

9. You forgot to copy the ibdata1 file in the original data folder. If you copy this file directly, you will be prompted that a file is in use. Go to the service, close the MySQL service, and then copy the file to the data folder. Then enable the MySQL service. Then you can query the m_cost table in the Europa database. No error is reported, and all the previous data is there.

The data folder in the MySQL installation directory stores Mysql Data. Each sub-folder in the data file corresponds to each database in MySQL. The. frm file in the subfolder corresponds to the corresponding table. DB files are character set configuration files. With these files, you can restore the data. You also need the ibdata1 file in the data folder.

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.