从.frm文件还原mysql数据库 [英] Restore the mysql database from .frm files

查看:172
本文介绍了从.frm文件还原mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每周都抛弃所有桌子以获得备份.但是后来我知道它只存储表的.frm文件.它没有显示表的.MYD和.MYI文件.因此,我只有数据库的.frm文件,而且mydatabase是innodb.那么我可以将数据库中的数据与我的数据库一起使用吗?

I have dumped all my tables everyweek to got the backup. But later I understand that it is only storing the .frm file of the table. It is not showing .MYD and .MYI files of a table. So I have only my .frm file of the database with me and also mydatabase is innodb. So can I get my database with data in the database?

推荐答案

是可以的.仅将.frm文件复制到databse文件夹中还不够,还需要将ib_logfilesibdata文件复制到数据文件夹中.我刚刚复制了.frm文件并复制了这些文件,然后仅重新启动了服务器并恢复了数据库.

Yes this is possible. It is not enough you just copy the .frm files to the to the databse folder but you also need to copy the ib_logfiles and ibdata file into your data folder. I have just copy the .frm files and copy those files and just restart the server and my database is restored.

复制以上文件后,执行以下命令-

After copying the above files execute the following command -

sudo chown -R mysql:mysql/var/lib/mysql

sudo chown -R mysql:mysql /var/lib/mysql

以上命令将mysql下的文件所有者更改为MySql用户.这对于mysql读取.frmibdata文件很重要.

The above command will change the file owner under mysql and it's folder to MySql user. Which is important for mysql to read the .frm and ibdata files.

这篇关于从.frm文件还原mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆