gpt4 book ai didi

mysql - 删除 .frm 文件后清除错误

转载 作者:行者123 更新时间:2023-11-29 01:58:36 27 4
gpt4 key购买 nike

我不小心删除了测试表的 .frm 文件。问题是我无法删除此表并将其从 information_schema 中删除。

select * from information_schema.tables where table_name like 'testtesttest';
+---------------+--------------+--------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------------+----------+----------------+----------------------------------------------------------+
| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | TABLE_TYPE | ENGINE | VERSION | ROW_FORMAT | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | MAX_DATA_LENGTH | INDEX_LENGTH | DATA_FREE | AUTO_INCREMENT | CREATE_TIME | UPDATE_TIME | CHECK_TIME | TABLE_COLLATION | CHECKSUM | CREATE_OPTIONS | TABLE_COMMENT |
+---------------+--------------+--------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------------+----------+----------------+----------------------------------------------------------+
| def | report | testtesttest | BASE TABLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Can't find file: './report/testtesttest.frm' (errno: 13) |
+---------------+--------------+--------------+------------+--------+---------+------------+------------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------------+----------+----------------+----------------------------------------------------------+

drop table report.testtesttest;
ERROR 1051 (42S02): Unknown table 'testtesttest'

有没有办法告诉mysql这样的表已经不存在了?

最佳答案

看起来以下步骤有帮助:

  1. touch/var/lib/mysql/report/testtesttest.{frm,ibd}
  2. chown mysql:mysql/var/lib/mysql/report/testtesttest.frm
  3. 重启mysql
  4. drop table report.testtesttest;

关于mysql - 删除 .frm 文件后清除错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21001322/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com