当前位置:网站首页>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
边栏推荐
- 使用pyhon封装一个定时发送邮件的工具类
- Distributed cluster architecture scenario optimization solution: session sharing problem
- Create a virtual environment using pycharm
- Linux(centOs7) 下安装redis
- 【二】redis基础命令与使用场景
- The difference between null and undefined
- Regular verification rules of wechat applet mobile number
- Flink CDC (MySQL as an example)
- Chapter IX sub query (key)
- MarsNFT :个人如何发行数字藏品?
猜你喜欢
随机推荐
【五】redis主从同步与Redis Sentinel(哨兵)
文件上传漏洞总结
撞脸ins? Mars数字藏品平台探索数字藏品轻社交
Sales notice: on July 22, the "great heat" will be sold, and the [traditional national wind 24 solar terms] will be sold in summer.
Kotlin语言现在怎么不火了?你怎么看?
数字藏品成文旅产业新热点
Structured streaming in spark
分布式集群架构场景优化解决方案:分布式ID解决方案
Distributed lock database implementation
Related concepts and operations of DOM model
It's not easy to travel. You can use digital collections to brush the sense of existence in scenic spots
【六】redis缓存策略
浅拷贝、深拷贝区别
Chapter 7 single line function
【七】redis缓存与数据库数据一致性
南京邮电大学CTF题目writeup (一) 含题目地址
trino函数随记
记录下在线扩容服务器遇到的问题 NOCHANGE: partition 1 is size 419428319. it cannot be grown
Distributed cluster architecture scenario optimization solution: session sharing problem
No module named yum








