{"id":788,"date":"2015-01-12T21:24:23","date_gmt":"2015-01-12T15:24:23","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=788"},"modified":"2015-01-21T19:14:58","modified_gmt":"2015-01-21T13:14:58","slug":"mysql-myisamchk","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=788","title":{"rendered":"MySQL: myisamchk"},"content":{"rendered":"<p>Decided to get better knowledge of MySQL with crawling on http:\/\/dev.mysql.com\/doc\/refman\/YOUR_VERSION\/en\/ , for example <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/\" target=\"_blank\">http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/<\/a> .<\/p>\n<p>Before MySQL 5.5.5, <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/myisam-storage-engine.html\" target=\"_blank\">MyISAM was the default storage engine<\/a>. (The default was changed to InnoDB in MySQL 5.5.5.)<br \/>\nOne of my deployments uses MySQL version prior to 5.5.5. While reading the documentation I found a nice utility, &#8216;<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/myisamchk.html\" target=\"_blank\">myisamchk<\/a>&#8216; and instantly decided to check with it one of *.MYI files. I was a little bit astonished when the utilite showed me some problems with one of files, while everything worked fine. This is the silent mode, only errors (if found) are showed:<\/p>\n<pre>root@zenwalk:~# myisamchk -s \/var\/lib\/mysql\/webapp\/doityourself.MYI\r\nmyisamchk: MyISAM file \/var\/lib\/mysql\/webapp\/doityourself.MYI\r\nmyisamchk: warning: 12 clients are using or haven't closed the table properly\r\nMyISAM-table '\/var\/lib\/mysql\/webapp\/doityourself.MYI' is usable but should be fixed<\/pre>\n<p>Normal mode:<\/p>\n<pre>\r\nroot@zenwalk:~# myisamchk \/var\/lib\/mysql\/webapp\/doityourself.MYI\r\nChecking MyISAM file: \/var\/lib\/mysql\/webapp\/doityourself.MYI\r\nData records:     170   Deleted blocks:       2\r\nmyisamchk: warning: 12 clients are using or haven't closed the table properly\r\n- check file-size\r\n- check record delete-chain\r\n- check key delete-chain\r\n- check index reference\r\n- check data record references index: 1\r\n- check data record references index: 2\r\n- check record links\r\nMyISAM-table '\/var\/lib\/mysql\/webapp\/doityourself.MYI' is usable but should be fixed\r\n<\/pre>\n<p>So, let&#8217;s recover the .MYI file. Fire!<\/p>\n<pre>\r\nroot@zenwalk:~# myisamchk --recover \/var\/lib\/mysql\/webapp\/doityourself.MYI\r\n- recovering (with sort) MyISAM-table '\/var\/lib\/mysql\/webapp\/doityourself.MYI'\r\nData records: 170\r\n- Fixing index 1\r\n- Fixing index 2\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Decided to get better knowledge of MySQL with crawling on http:\/\/dev.mysql.com\/doc\/refman\/YOUR_VERSION\/en\/ , for example http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/ . Before MySQL 5.5.5, MyISAM was the default storage engine. (The default was changed to InnoDB in MySQL 5.5.5.) One of my deployments uses MySQL version prior to 5.5.5. While reading the documentation I found a nice utility, &#8216;myisamchk&#8216; and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[199,198,80,93],"class_list":["post-788","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-myisam","tag-myisamchk","tag-mysql","tag-sql"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=788"}],"version-history":[{"count":5,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/788\/revisions"}],"predecessor-version":[{"id":796,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/788\/revisions\/796"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}