mysql - 异常的 mysql frm 和 idb 文件

标签 mysql

我启用了 innodb_file_per_table 选项,因此每个表都有一个 .frm 和一个 .ibd 文件。不寻常的是还有一些文件似乎来自文件系统上的临时表:

/db/mysql$ ls
<snip>
 #sql2-25fe-5.frm
 #sql2-25fe-5.ibd
 #sql2-55f4-73.frm
 #sql2-55f4-73.ibd
 #sql-55f6_13b626.ibd
 #sql-6abe_e3.ibd
</snip>

其中一个相当大,所以如果安全的话我想摆脱它们。我尝试像删除常规表和临时表一样删除它们,但不管怎样都行不通。

drop table `#sql2-25fe-5`;
drop temporary table `#sql2-25fe-5`;

有什么想法吗?谢谢

最佳答案

只是为了解决这个问题:

转储并重新加载所有表释放了我想要的空间(innobackupex 备份和恢复不起作用)。我相信这些永久临时表是 mysql 中已修复的两个错误之一的结果:

InnoDB: If the server crashed at a precise moment during an ALTER TABLE operation that rebuilt the clustered index for an InnoDB table, the original table could be inaccessible afterward. An example of such an operation is ALTER TABLE ... ADD PRIMARY KEY The fix preserves the original table if the server halts during this operation. You might still need to rename the .ibd file manually to restore the original table contents: in MySQL 5.6 and higher, rename from #sql-ib$new_table_id.ibd to table_name.ibd within the database directory; prior to MySQL 5.6, the temporary file to rename is table_name#1 or #2. (Bug #14669848)

https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-30.html

InnoDB: For UPDATE statements in which an error occurred, it was possible for a temporary file opened during the update not to be closed. (Bug #15978766)

https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-32.html

关于mysql - 异常的 mysql frm 和 idb 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17982184/

相关文章:

php - 如果在单个表 php 中更新了 parent 的值,则更新 child 的值

php - 在 Wordpress 管理仪表板中执行查询

mysql - 使用地名数据库获取城市所属的州和县?

php - 使用php从数据库中获取多行

php - 根据选择的字母按钮列出商店名称

mysql - 选择 id 不不同的每一行

MySQL神秘错误

mysql - 使用 ActiveRecord 和 MySQL 插入 DATETIME

php - 如何在递归函数中显示php mysql中的所有结果

mysql - MySQL UPDATE 的 WHERE 子句中的条件无效 - 更新了所有内容 - 而不是没有