This article describes how to recover data after Mysql becomes invalid. In some special cases, the Mysql database becomes invalid and the data cannot be exported. 1. reinstall MySQL locally (Installation Directory D: \ Program Files \ MySQL Server 5.0) and directly copy the mysql folder to D: \ Program Files \ MySQL Server 5.0 \. Result: The database connection is incorrect. 2. after uninstallation, reinstall MySQL and back up the data under D: \ Program Files \ MySQL Server 5.0 \. Only copy all the content in the mysql \ data folder to D: \ Program Files \ MySQL Server 5.0 \ data. Result: The database connection is incorrect. Overwrite the backup data. As a result, the database fails to be connected. 3. after uninstallation, reinstall MySQL and copy the cf1 and last folders (the two are the databases in the original mysql) in the MySQL \ data folder to D: \ Program Files \ MySQL Server 5.0 \ data. The connection is successful. The cf1 and last databases are displayed in Navicat for MySQL, but they cannot be accessed because the data is completely zero. I understand that the file named after the database in the original data stores the table structure of the database, not the metadata. Next, copy the ibdata1 file (3.4G large, obviously storing metadata) in the data folder to D: \ Program Files \ MySQL Server 5.0 \ data, replace the original ibdata1 file. Restart your computer and enable Navicat for MySQL. The connection is successful and data can be accessed. Now, the operation is successful. In fact, it is easier to restore the data on that machine instead of copying the folder mysql directly. However, the machine has reinstalled the system, which means that MySQL is invalid.