Corrupt MySQL table - "Cannot find file" error; Any way to recover missing .myd and .myi files?
I am MySQL newbe and I am trying to fix a corrupted table in one of my databases. This is a simple IPS forum that is currently online. Earlier today I tried to execute mysqldump
and got this error:
mysqldump: Got error: 1017: Can't find file: 'wcsf_profile_portal_views' (errno: 2) when using LOCK TABLES
So I went to see what happened. One of the tables seems to be corrupted. I tried using repair, but I get the same error:
mysql> REPAIR TABLE wcsf_profile_portal_views;
+-----------------------------------------------+--------+----------+---------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+-----------------------------------------------+--------+----------+---------------------------------------------------------+
| wecreate_finalforum.wcsf_profile_portal_views | repair | Error | Can't find file: 'wcsf_profile_portal_views' (errno: 2) |
| wecreate_finalforum.wcsf_profile_portal_views | repair | status | Operation failed |
+-----------------------------------------------+--------+----------+---------------------------------------------------------+
2 rows in set (0.00 sec)
I went over it and tried several suggestions here http://www.databasejournal.com/features/mysql/article.php/10897_3300511_2/Repairing-Database-Corruption-in-MySQL.htm
But not yet succeed with mysqlcheck
or myisamchk
.
It is important to note that I am using MyISAM. I checked the database folder and it turned out that there were two files missing: wcsf_profile_portal_views.MYD and wcsf_profile_portal_views.MYI . However, the wcsf_profile_portal_views.frm file does exist. Accordingly, I tried REPAIR TABLE wcsf_profile_portal_views USE_FRM;
it but got it Can't open table
again.
I could not find the reason for the corruption yet. Any suggestions?
Edit: Undesirable, I tried to restore the table through old backups. No dice - apparently it was damaged for a while and this database was not even copied because it kept failing. I never noticed. FML. This is what you get for using WHM! Fortunately for me, this is not an important table. I believe this is part of the Invision Powered platforms. I did a local install and copied the table back to the live DB, repaired and it seems to work now - I can mysqldump
successfully, and now I think the backups will now work.
I would not answer this question because I did not quite fix it (data was lost) and I did not find what caused the corruption. Perhaps this is an IPB related issue.
source to share