当前位置:网站首页>Mysql5.6 (according to.Ibd,.Frm file) restore single table data
Mysql5.6 (according to.Ibd,.Frm file) restore single table data
2022-07-28 06:05:00 【ymony】
Premise :
There are data deleted .ibd file , You can extract it from the backup file of the database . Then on my virtual machine mysql yes 5.6 edition , Look at your local computer mysql5.5 Of data I don't think so .ibd file
step :
1、 Get into Linux virtual machine , Use service mysql stop stop it mysql service , stay mysql Of my.cnf Add below innodb_force_recovery=1 , start-up mysql service
[[email protected] ~]# service mysql stop -- stop it mysql
[[email protected] mysql]# cd /usr/local/mysql -- Get into mysql Catalog
[[email protected] mysql]# vim my.cnf -- edit my.cnf file
stay [mysqld] Add the following two lines
innodb_force_recovery=1 # You can set 1-6
innodb_purge_thread=0 # If the configuration value above is greater than 1, Here it should be set to 0, Otherwise, it will happen
# present InnoDB: Waiting for the background threads to start Error of .
2、service mysql start Start database , Use the database connection tool ( I am using navcat Database tools ) Create a new database with the same name and code format on the virtual machine , Generate the structure of the table to be restored .sql file , Run in the database with the same name of the virtual machine , There is a table with the same structure as the original .( The table structure must be the same )
3、 Put the original .ibd The document is the same as the original .frm File unbinding
alter table XXX( The table name of the data to be recovered ) discard tablespace;
4、Linux Get into mysql Of data Under the folder , Find the corresponding database folder , Delete the table that needs to be restored ibd file ( Not backed up )
5、 Put the watch on .ibd( Backup ) Put it in the fourth step to delete ibd The place of
6、 modify ibd File permissions , perform alter table tb import tablespace;
[[email protected] ~]# chmod 777 ibd file -- to ibd Document Authorization
alter table XXX( The table name of the data to be recovered ) import tablespace;
Then refresh the database , See the data and you will succeed
Be careful : Remember to take the first step innodb_force_recovery=1 Change those two sentences back , To avoid subsequent normal operation error
The pit I met :
Other information is in 3 Step after , There may be write off mysql, Finish copying ibd Start after mysql, But I've tried and I can't ( May and mysql Version related , No specific research ), And after the third step, use service mysql start restart mysql when , Start... Will appear mysql Failure , Checking the data according to the error information did not solve , then reboot Restart the virtual machine and start mysql It can be connected normally
Reference article :https://www.cnblogs.com/hankyoon/p/5667884.html
边栏推荐
猜你喜欢

Wechat official account - authorized login

登录时密码错误次数过多,对该用户进行封禁,

Cookie、Session和Token的区别与联系

mysql分页出现问题

微服务架构认知、服务治理-Eureka

Hit your face ins? Mars digital collection platform explores digital collection light social networking

At the moment of the epidemic, online and offline travelers are trapped. Can the digital collection be released?

【六】redis缓存策略

项目不报错,正常运行,无法请求到服务

Prime_Series靶场从探测到提权
随机推荐
Phoenix
区分实时数据、离线数据、流式数据以及批量数据的区别
分布式锁-数据库实现
服务可靠性保障-watchdog
Wechat official account - authorized login
Flink CDC (MySQL as an example)
预告来袭:【豆冰冰】发.售,现.金.抽.奖等你来拿
数据仓库工具superset安装(完全可用)
ctfshow单身狗 -- web
Distributed cluster architecture scenario optimization solution: distributed ID solution
连续登陆问题
微服务架构认知、服务治理-Eureka
CMD and NPM basic commands
The combination of cultural tourism and digital collections has a significant effect, but how to support users' continuous purchasing power
regular expression
MYSQL的select语句查询;运算符课后练习
Structured streaming in spark
第九章 子查询(重点)
Trino function tag
Redis 主从架构的搭建