When recovering a MyISAM table the only file that is strictly needed is the data file (tablename.MYD
) - the rest of the files (the index file tablename.MYI
and tablename.frm
) can be recreated from the data file using REPAIR TABLE
.
恢复MyISAM表时,唯一需要的文件是数据文件(tablename.MYD) - 可以使用REPAIR TABLE从数据文件重新创建其余文件(索引文件tablename.MYI和tablename.frm)。
Assume I'm using InnoDB (with the "innodb_file_per_table
" setting) instead - what is the minimum set of files needed to recover a database table from file?
假设我正在使用InnoDB(使用“innodb_file_per_table”设置) - 从文件中恢复数据库表所需的最小文件集是什么?
2 个解决方案
#1
As long as you have the data file and the log files then InnoDB will be able to recover. See this page (and containing chapter) on MySQL.com for more. InnoDB recover is quite different to MyISAM in that is more "built-in" as it were.
只要您拥有数据文件和日志文件,InnoDB就能够恢复。有关更多信息,请参阅MySQL.com上的此页面(并包含章节)。 InnoDB恢复与MyISAM完全不同,因为它更像是“内置”的。
#2
To recover MyISAM table you need frm and MYD file. myisamchk can rebuild the index (MYI file)
要恢复MyISAM表,您需要frm和MYD文件。 myisamchk可以重建索引(MYI文件)
For InnoDB - depends on innodb_file_per_table. If it's OFF (default), your data in ibdata1. But you need .frm file too. If it's ON - you need ibdata1, the respective .ibd and .frm file.
对于InnoDB - 取决于innodb_file_per_table。如果它是OFF(默认),则表示您在ibdata1中的数据。但是你也需要.frm文件。如果它是ON - 你需要ibdata1,相应的.ibd和.frm文件。
#1
As long as you have the data file and the log files then InnoDB will be able to recover. See this page (and containing chapter) on MySQL.com for more. InnoDB recover is quite different to MyISAM in that is more "built-in" as it were.
只要您拥有数据文件和日志文件,InnoDB就能够恢复。有关更多信息,请参阅MySQL.com上的此页面(并包含章节)。 InnoDB恢复与MyISAM完全不同,因为它更像是“内置”的。
#2
To recover MyISAM table you need frm and MYD file. myisamchk can rebuild the index (MYI file)
要恢复MyISAM表,您需要frm和MYD文件。 myisamchk可以重建索引(MYI文件)
For InnoDB - depends on innodb_file_per_table. If it's OFF (default), your data in ibdata1. But you need .frm file too. If it's ON - you need ibdata1, the respective .ibd and .frm file.
对于InnoDB - 取决于innodb_file_per_table。如果它是OFF(默认),则表示您在ibdata1中的数据。但是你也需要.frm文件。如果它是ON - 你需要ibdata1,相应的.ibd和.frm文件。