In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Mysql5.7 uses frm and ibd to recover data
1. Create a new database with the same name, and create a new table with the same name in it, with arbitrary fields.
-if you have the table structure of the original table, this step can be omitted
Add my.cnf profile to innodb_force_recovery=6
2. Overwrite the backup .frm file over the .frm file of the newly created table, modify the file owner and permissions, and restart the database. At this time, the err file will prompt you that the number of fields in the table structure is inconsistent.
3. Create a table with the same name repeatedly. There are as many fields as prompted, and the field name type is arbitrary.
4. Overwrite the backup .frm file over the .frm file of the newly created table, modify the file owner and permissions, and restart the database; so that the table structure is restored.
5. Rebuild the new table according to the table structure, and specify the ROW_FORMAT attribute of the table, ROW_FORMAT=COMPACT
CREATE TABLE ty (
Id bigint (20) NOT NULL AUTO_INCREMENT COMMENT 'primary key'
Valid int (11) whether DEFAULT'1' COMMENT'is valid 1: valid 0: invalid'
Rel varchar (25) DEFAULT NULL
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT
In this way, the table structure is restored.
6. Restore data
Execute the discard tablespace command in the specified database
Alter table ty discard tablespace
7. Copy the original ibd file, overwrite the newly created table ibd, and modify the permissions
Chown mysql.mysql ty.ibd
8. Import tablespaces
Alter table ty import tablespace
So the whole data is restored.
-End-By-TangYun-2019.10.14-
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.