{"id":28287,"date":"2017-12-20T10:51:37","date_gmt":"2017-12-20T08:51:37","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=28287"},"modified":"2017-12-20T10:51:37","modified_gmt":"2017-12-20T08:51:37","slug":"mysql-optimize-repair-and-analyze","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/","title":{"rendered":"MySQL optimize, repair, and analyze"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>Years ago I had the following script running as a cron job, but then I lost it somewhere.\u00a0 It took me a few minutes to find it again, but just in case I need it in the future, I&#8217;m saving it here.<\/p>\n<pre class=\"brush: bash; light: true; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\nmysqlcheck --all-databases\r\nmysqlcheck --all-databases -o\r\nmysqlcheck --all-databases --auto-repair\r\nmysqlcheck --all-databases --analyze\r\n<\/pre>\n<p>Found it <a href=\"https:\/\/stackoverflow.com\/a\/23944159\/151647\">here<\/a> this time.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Years ago I had the following script running as a cron job, but then I lost it somewhere.\u00a0 It took me a few minutes to find it again, but just in case I need it in the future, I&#8217;m saving it here. #!\/bin\/bash mysqlcheck &#8211;all-databases mysqlcheck &#8211;all-databases -o mysqlcheck &#8211;all-databases &#8211;auto-repair mysqlcheck &#8211;all-databases &#8211;analyze Found &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MySQL optimize, repair, and analyze<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"MySQL optimize, repair, and analyze #MySQL #WebDev #SysAdmin #databases #performance #CLI","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[1,6,133,62,1334],"tags":[1960,1559,3066,1057,1330],"keyring_services":[],"class_list":["post-28287","post","type-post","status-publish","format-standard","hentry","category-general","category-linux","category-sysadmin","category-technology","category-web-work","tag-command-line","tag-databases","tag-mysql","tag-performance","tag-web-development"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I&#039;m saving it here. [code light=&quot;true&quot; lang=&quot;bash&quot;] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Leonid Mamchenkov\"\/>\n\t<meta name=\"google-site-verification\" content=\"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Leonid Mamchenkov - Life, universe, and everything else\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"MySQL optimize, repair, and analyze - Leonid Mamchenkov\" \/>\n\t\t<meta property=\"og:description\" content=\"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I&#039;m saving it here. [code light=&quot;true&quot; lang=&quot;bash&quot;] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-12-20T08:51:37+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2017-12-20T08:51:37+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/MamchenkovBlog\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:title\" content=\"MySQL optimize, repair, and analyze - Leonid Mamchenkov\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I&#039;m saving it here. [code light=&quot;true&quot; lang=&quot;bash&quot;] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#blogposting\",\"name\":\"MySQL optimize, repair, and analyze - Leonid Mamchenkov\",\"headline\":\"MySQL optimize, repair, and analyze\",\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"},\"datePublished\":\"2017-12-20T10:51:37+02:00\",\"dateModified\":\"2017-12-20T10:51:37+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":4,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#webpage\"},\"articleSection\":\"All, Linux, Sysadmin, Technology, Web work, command line, databases, MySQL, performance, web development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/#listItem\",\"name\":\"Linux\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/#listItem\",\"position\":3,\"name\":\"Linux\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#listItem\",\"name\":\"MySQL optimize, repair, and analyze\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#listItem\",\"position\":4,\"name\":\"MySQL optimize, repair, and analyze\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/#listItem\",\"name\":\"Linux\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#webpage\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/\",\"name\":\"MySQL optimize, repair, and analyze - Leonid Mamchenkov\",\"description\":\"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I'm saving it here. [code light=\\\"true\\\" lang=\\\"bash\\\"] #!\\\/bin\\\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/20\\\/mysql-optimize-repair-and-analyze\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"datePublished\":\"2017-12-20T10:51:37+02:00\",\"dateModified\":\"2017-12-20T10:51:37+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/\",\"name\":\"Blog of Leonid Mamchenkov\",\"description\":\"Life, universe, and everything else\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"MySQL optimize, repair, and analyze - Leonid Mamchenkov","description":"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I'm saving it here. [code light=\"true\" lang=\"bash\"] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck","canonical_url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#blogposting","name":"MySQL optimize, repair, and analyze - Leonid Mamchenkov","headline":"MySQL optimize, repair, and analyze","author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"},"datePublished":"2017-12-20T10:51:37+02:00","dateModified":"2017-12-20T10:51:37+02:00","inLanguage":"en-US","commentCount":4,"mainEntityOfPage":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#webpage"},"isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#webpage"},"articleSection":"All, Linux, Sysadmin, Technology, Web work, command line, databases, MySQL, performance, web development"},{"@type":"BreadcrumbList","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/mamchenkov.net\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/#listItem","name":"Linux"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/#listItem","position":3,"name":"Linux","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#listItem","name":"MySQL optimize, repair, and analyze"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#listItem","position":4,"name":"MySQL optimize, repair, and analyze","previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/#listItem","name":"Linux"}}]},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/#person","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author","url":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"WebPage","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#webpage","url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/","name":"MySQL optimize, repair, and analyze - Leonid Mamchenkov","description":"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I'm saving it here. [code light=\"true\" lang=\"bash\"] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/#breadcrumblist"},"author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"creator":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"datePublished":"2017-12-20T10:51:37+02:00","dateModified":"2017-12-20T10:51:37+02:00"},{"@type":"WebSite","@id":"https:\/\/mamchenkov.net\/wordpress\/#website","url":"https:\/\/mamchenkov.net\/wordpress\/","name":"Blog of Leonid Mamchenkov","description":"Life, universe, and everything else","inLanguage":"en-US","publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"}}]},"og:locale":"en_US","og:site_name":"Leonid Mamchenkov - Life, universe, and everything else","og:type":"article","og:title":"MySQL optimize, repair, and analyze - Leonid Mamchenkov","og:description":"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I'm saving it here. [code light=&quot;true&quot; lang=&quot;bash&quot;] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck","og:url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/","og:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:secure_url":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:width":1024,"og:image:height":1024,"article:published_time":"2017-12-20T08:51:37+00:00","article:modified_time":"2017-12-20T08:51:37+00:00","article:publisher":"https:\/\/www.facebook.com\/MamchenkovBlog","twitter:card":"summary_large_image","twitter:site":"@mamchenkov","twitter:title":"MySQL optimize, repair, and analyze - Leonid Mamchenkov","twitter:description":"Years ago I had the following script running as a cron job, but then I lost it somewhere. It took me a few minutes to find it again, but just in case I need it in the future, I'm saving it here. [code light=&quot;true&quot; lang=&quot;bash&quot;] #!\/bin\/bash mysqlcheck --all-databases mysqlcheck --all-databases -o mysqlcheck --all-databases --auto-repair mysqlcheck","twitter:creator":"@mamchenkov","twitter:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg"},"aioseo_meta_data":{"post_id":"28287","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-07-20 05:05:58","updated":"2026-01-15 13:23:44","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/\" title=\"Linux\">Linux<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMySQL optimize, repair, and analyze\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mamchenkov.net\/wordpress"},{"label":"Technology","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/"},{"label":"Linux","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/"},{"label":"MySQL optimize, repair, and analyze","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/20\/mysql-optimize-repair-and-analyze\/"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":29062,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/12\/10\/mysql-high-availability-at-github\/","url_meta":{"origin":28287,"position":0},"title":"MySQL High Availability at GitHub","author":"Leonid Mamchenkov","date":"December 10, 2018","format":false,"excerpt":"Shlomi Noach, GitHub's Senior Infrastructure Engineer, shares some details on both the current and future high availability setup of MySQL databases at GitHub. This is probably way too far out for most people using MySQL for their web applications.\u00a0 But it does highlight the technical complexity of running high load\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/mysql-ha-solution-at-github.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/mysql-ha-solution-at-github.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/mysql-ha-solution-at-github.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/mysql-ha-solution-at-github.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/mysql-ha-solution-at-github.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/mysql-ha-solution-at-github.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":22487,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/09\/03\/making-mysql-better-at-github\/","url_meta":{"origin":28287,"position":1},"title":"Making MySQL Better at GitHub","author":"Leonid Mamchenkov","date":"September 3, 2014","format":"link","excerpt":"Making MySQL Better at GitHub \u00a0 \u00a0","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"mysql improvements at GitHub","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2014\/09\/mysql-improvements-at-GitHub-500x240.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":10151,"url":"https:\/\/mamchenkov.net\/wordpress\/2006\/05\/31\/daily-del-icio-us-bookmarks\/","url_meta":{"origin":28287,"position":2},"title":"Daily del.icio.us bookmarks","author":"Leonid Mamchenkov","date":"May 31, 2006","format":false,"excerpt":"Shared bookmarks for del.icio.us user tvset on 2006-05-30 MySQL Performance Blog \u00c2\u00bb INSERT ON DUPLICATE KEY UPDATE and summary counters. Tagged as: code databases mysql optimization performance programming sql tips tricks Read\/WriteWeb: Worldwide Internet Penetration is just 15% Tagged as: statistics stats web world","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27483,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/04\/04\/how-to-synchronize-wordpress-live-and-development-databases\/","url_meta":{"origin":28287,"position":3},"title":"How to Synchronize WordPress Live and Development Databases","author":"Leonid Mamchenkov","date":"April 4, 2017","format":false,"excerpt":"SitePoint runs through a few options that one can use to synchronize WordPress live and development databases. \u00a0I've linked to \u00a0some of these options before, but it's nice to have them all conveniently together. \u00a0The solutions discussed include WordPress-specific tools: WP Migrate DB Pro WP Sync DB WPSiteSync for Content\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2017\/04\/databases-500x310.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":28562,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/05\/08\/database-flow-modern-self-hosted-web-interface-for-sql-and-graphql\/","url_meta":{"origin":28287,"position":4},"title":"Database Flow &#8211; modern, self-hosted web interface for SQL and GraphQL","author":"Leonid Mamchenkov","date":"May 8, 2018","format":false,"excerpt":"Database Flow is a modern, Open Source, self-hosted, web-based tool for working with SQL databases and GraphQL APIs.\u00a0 It supports a variety of the database engines: IBM DB2, Oracle, H2, PostgreSQL, MySQL, SQLite, Informix, and Microsoft SQL Server.\u00a0 It features an advanced SQL editor, query plan analyzer, GraphQL client, schema\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/05\/database-flow-500x281.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":23544,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/02\/18\/mysql-compare-compare-two-database-structures-and-get-the-differences-between-them\/","url_meta":{"origin":28287,"position":5},"title":"MySQL Compare &#8211; compare two database structures and get the differences between them","author":"Leonid Mamchenkov","date":"February 18, 2015","format":"link","excerpt":"MySQL Compare - compare two database structures and get the differences between them","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=28287"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28287\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=28287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=28287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=28287"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=28287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}