如何从MySQL .frm恢复数据? [英] How to restore data from MySQL .frm?
问题描述
我所有数据都存储在MySQL的.frm文件中.如何还原数据?我不想还原所有记录,仅还原一些记录和表,因此我需要从中进行转储.
I have all data in MySQL's .frm files. How can I restore the data? I do not want to restore all of them, just some records and tables so I need to make dumps out of them.
据我所知,只有.frm文件,没有.myd文件.但是,有ibdata1文件.我应该如何恢复?
From what I can see, there are only .frm files, no .myd files. There is, however, ibdata1 file. How am I supposed to restore?
推荐答案
我可以使用它.
1)我创建了一个空数据库,该数据库以本地安装中服务器上的真实数据库的名称命名.
1) I created an empty database named after what the real database was on the server in my local installation.
2)我杀死了"mysqld"
2) I killed "mysqld"
3)我将三个ib *文件复制到了本地MySQL数据目录(在Windows上,这是根驱动器中的一个隐藏文件夹).确保您已复制到InnoDB数据文件目录,具体取决于您的my.cnf InnoDB和MyISAM数据可能存储在不同的文件夹中.我还复制了.frm文件.
3) I copied the three ib* files to my local MySQL data directory (on Windows it was a hidden folder in root drive). Make sure you copied to InnoDB data file directory, depending on your my.cnf InnoDB and MyISAM data may be stored in different folders. I also copied the .frm files.
4)我跑了"C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files (x86)\MySQL\MySQL Server 5.1\my.ini" --innodb-force-recovery=6
5)我运行mysql -uroot -pmypass
确认use mydb; select * from mytable;
返回的结果.
5) I ran mysql -uroot -pmypass
to confirm use mydb; select * from mytable;
returned results.
6)我使用了mysqldump mydb mytable --compact > file.sql
就是这样!
这篇关于如何从MySQL .frm恢复数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!