Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.0.30, 10.3.9, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
Linux or Windows server
Description
With mysqlcheck -r --use-frm database table it should be possible to repair a myisam table even if the MYI file is corrupted.
CREATE TABLE IF NOT EXISTS `testdb`.`t1` ( |
`Idx` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT , |
PRIMARY KEY (`Idx`)) |
ENGINE = MYISAM
|
DEFAULT CHARACTER SET = latin1 |
COLLATE = latin1_german1_ci |
COMMENT = 'test table'; |
mysqlcheck -ce testdb t1
|
testdb.t1 OK
|
|
rm t1.MYI
|
mysqlcheck -ce testdb t1
|
Failed to SHOW CREATE TABLE `t1`
|
Error: Can't find file: './testdb/t1.MYI' (errno: 2 "No such file or directory")
|
|
mysqlcheck -r --use-frm testdb t1
|
Failed to SHOW CREATE TABLE `t1`
|
Error: Can't find file: './testdb/t1.MYI' (errno: 2 "No such file or directory")
|
mysql --database=testdb --execute="REPAIR TABLE t1 USE_FRM"
|
+------------------+--------+----------+------------------------------------+
|
| Table | Op | Msg_type | Msg_text |
|
+------------------+--------+----------+------------------------------------+
|
| testdb.t1 | repair | warning | Number of rows changed from 0 to 6 |
|
| testdb.t1 | repair | status | OK |
|
+------------------+--------+----------+------------------------------------+
|
mysqlcheck -ce testdb t1
|
testdb.t1
|
It can actually be repaired, if a table name is omitted and the operation is performed for the whole schema. The reason is that when the table name is provided, the tool issues SHOW CREATE TABLE for it (to define whether it's a view) and chokes on this failing statement.