他是数据库结构文件,但是只有这一个,数据库提示损坏,不能够读取或者使用,
只需要这个结构文件,数据无所谓了,请问谁知道怎么恢复。
3 个解决方案
#1
试一试用这个命令来删除表,它会在删除后重建表,只要你的frm文件是好用的就可以将表结构恢复。
TRUNCATE TABLE table_name
TRUNCATE TABLE table_name
#2
我用楼上的方法,删除了一个表的.MYD和.MYI文件,然后用了以下命令:
mysql> select * from cities;
ERROR 1017 (HY000): Can't find file: 'cities.MYI' (errno: 2)
mysql> truncate table cities;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from cities;
Empty set (0.00 sec)
mysql> desc cities;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| cityid | int(4) | | PRI | NULL | auto_increment |
| CityName | varchar(10) | | | | |
+----------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
从上可以看出,已经恢复成一个空表了.
mysql> select * from cities;
ERROR 1017 (HY000): Can't find file: 'cities.MYI' (errno: 2)
mysql> truncate table cities;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from cities;
Empty set (0.00 sec)
mysql> desc cities;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| cityid | int(4) | | PRI | NULL | auto_increment |
| CityName | varchar(10) | | | | |
+----------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
从上可以看出,已经恢复成一个空表了.
#3
好的,谢谢啊
#1
试一试用这个命令来删除表,它会在删除后重建表,只要你的frm文件是好用的就可以将表结构恢复。
TRUNCATE TABLE table_name
TRUNCATE TABLE table_name
#2
我用楼上的方法,删除了一个表的.MYD和.MYI文件,然后用了以下命令:
mysql> select * from cities;
ERROR 1017 (HY000): Can't find file: 'cities.MYI' (errno: 2)
mysql> truncate table cities;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from cities;
Empty set (0.00 sec)
mysql> desc cities;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| cityid | int(4) | | PRI | NULL | auto_increment |
| CityName | varchar(10) | | | | |
+----------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
从上可以看出,已经恢复成一个空表了.
mysql> select * from cities;
ERROR 1017 (HY000): Can't find file: 'cities.MYI' (errno: 2)
mysql> truncate table cities;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from cities;
Empty set (0.00 sec)
mysql> desc cities;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| cityid | int(4) | | PRI | NULL | auto_increment |
| CityName | varchar(10) | | | | |
+----------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
从上可以看出,已经恢复成一个空表了.
#3
好的,谢谢啊