{"id":96,"date":"2008-10-22T10:16:15","date_gmt":"2008-10-22T14:16:15","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/2008\/10\/22\/recovering-from-mysql-myi-corruption\/"},"modified":"2008-10-22T10:16:15","modified_gmt":"2008-10-22T14:16:15","slug":"recovering-from-mysql-myi-corruption","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2008\/10\/22\/recovering-from-mysql-myi-corruption\/","title":{"rendered":"Recovering from MySQL *.MYI corruption"},"content":{"rendered":"<p>Personally, I experienced this with the Bugzilla software issue tracking software.  The message I got on the browser screen is as follows.<\/p>\n<p class=\"code\">\n<b>Software error:<\/b><\/p>\n<p>DBD::mysql::db selectrow_array failed: Can&#8217;t open file: &#8216;logincookies.MYI&#8217; (errno: 145) [for Statement &quot;SELECT profiles.userid, profiles.disabledtext FROM logincookies, profiles WHERE logincookies.cookie=? AND   logincookies.userid=profiles.userid AND   logincookies.userid=? AND   (logincookies.ipaddr=? OR logincookies.ipaddr=?)&quot;] at Bugzilla\/Auth\/Cookie.pm line 69<\/p>\n<p>Bugzilla::Auth::Cookie::authenticate(&#8216;Bugzilla::Auth::Cookie&#8217;, 5, 4928) called at Bugzilla\/Auth\/CGI.pm line 106<\/p>\n<p>Bugzilla::Auth::CGI::login(&#8216;Bugzilla::Auth::CGI&#8217;, 1) called at Bugzilla.pm line 74<\/p>\n<p>Bugzilla::login(&#8216;Bugzilla&#8217;) called at C:\/bugzilla\/buglist.cgi line 81<\/p>\n<p>For help, please send mail to the webmaster (&#8230;@&#8230;&#8230;), giving this error message and the time and date of the error.\n<\/p>\n<p>To resolve the issue, I first stopped the MySQL database.<\/p>\n<pre class=\"code\">\nC:>net stop mysql\nThe MySQL service is stopping..\nThe MySQL service was stopped successfully.\n<\/pre>\n<p>Then, I issued the myisamchk.exe command as below to recover the table that became corrupted; for me, it was the logincookies.MYI file.<\/p>\n<pre class=\"code\">\nC:>c:mysqlbinmyisamchk.exe -r logincookies.MYI\n- recovering (with sort) MyISAM-table 'logincookies.MYI'\nData records: 158\n- Fixing index 1\n- Fixing index 2\n<\/pre>\n<p>Once the recovering process was completed, I restarted the MySQL database.<\/p>\n<pre class=\"code\">\nC:>net start mysql\nThe MySQL service is starting.\nThe MySQL service was started successfully.\n<\/pre>\n<p>Once the MySQL restart is completed, the database was functioning properly once again, and my Bugzilla system was running without a hitch.  Alternatively, I could have logged in to MySQL and issued the following SQL command to repair the corrupted table.<\/p>\n<pre class=\"code\">\nuse bugzilla;\nrepair table logincookies.MYI;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If your application gives you a message similar to &#8220;Can&#8217;t open file: &#8216;*.MYI&#8217; (errno: 145)&#8221;, you are likely experiencing a MySQL corruption problem on a particular table.  This note details how to recover from this problem fairly easily.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":0,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}