{"id":3203,"date":"2020-06-06T17:07:36","date_gmt":"2020-06-06T11:37:36","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=3203"},"modified":"2023-01-26T17:30:23","modified_gmt":"2023-01-26T12:00:23","slug":"how-to-optimize-mysql","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/","title":{"rendered":"How to Optimize MySQL"},"content":{"rendered":"\n<p><strong>IMPORTANT<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Always <a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.24x7serversupport.com\/blog\/backup-sql-files-with-custombuild-2-0\/\">make full backups of all of your databases<\/a> before making any changes to your my.cnf.<\/li>\n\n\n\n<li>Avoid changes to your InnoDB settings unless you are very familiar with making those changes. &nbsp;Many of the InnoDB settings must remain the same else data corruption will occur with your InnoDB tables. &nbsp;We do not recommend making any changes to your InnoDB settings, unless you do so before creating your databases.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">CentOS<\/h3>\n\n\n\n<p>There is a default my.cnf that comes with mysql (4+5) that will make mysql run a bit quicker if you have 2+ gig of ram<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cp -f \/usr\/share\/mysql\/my-large.cnf \/etc\/my.cnf<\/pre>\n\n\n\n<p>There is also my-huge.cnf, or my-medium.cnf depending on your hardware setup. &nbsp; Check the contents of these my*.cnf files for the one that&#8217;s right for you.<br><br><strong>*NOTE 1*<\/strong> the log-bin option is enabled by default. &nbsp;This will quickly use a lot of disk space. &nbsp;It&#8217;s recommended to comment out the log-bin line from your \/etc\/my.cnf, if it exists.<br><br><strong>*NOTE 2*<\/strong> Take note of your old \/etc\/my.cnf file. &nbsp;If you have innodb_file_per_table=1 make sure the new my.cnf you install also has this setting. &nbsp;Similarly, if your old one does not have innodb_file_per_table=1 enabled, then your new my.cnf should also not have it enabled. &nbsp; If the new my.cnf has a different setting for innodb_file_per_table, then it may corrupt your data.<br><br>Be sure to make full backups of your .sql files before doing any changes to your my.cnf.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>IMPORTANT CentOS There is a default my.cnf that comes with mysql (4+5) that will make mysql run a bit quicker if you have 2+ gig of ram cp -f \/usr\/share\/mysql\/my-large.cnf \/etc\/my.cnf There is also my-huge.cnf, or my-medium.cnf depending on your hardware setup. &nbsp; Check the contents of these my*.cnf files for the one that&#8217;s right [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3557,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[273],"tags":[],"class_list":["post-3203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-directadmin"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Optimize MySQL | 24x7serversupport Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Optimize MySQL | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"IMPORTANT CentOS There is a default my.cnf that comes with mysql (4+5) that will make mysql run a bit quicker if you have 2+ gig of ram cp -f \/usr\/share\/mysql\/my-large.cnf \/etc\/my.cnf There is also my-huge.cnf, or my-medium.cnf depending on your hardware setup. &nbsp; Check the contents of these my*.cnf files for the one that&#8217;s right [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-06T11:37:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-26T12:00:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"536\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/\",\"name\":\"How to Optimize MySQL | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1\",\"datePublished\":\"2020-06-06T11:37:36+00:00\",\"dateModified\":\"2023-01-26T12:00:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1\",\"width\":1024,\"height\":536,\"caption\":\"Optimize MySQL\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Optimize MySQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Optimize MySQL | 24x7serversupport Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/","og_locale":"en_US","og_type":"article","og_title":"How to Optimize MySQL | 24x7serversupport Blog","og_description":"IMPORTANT CentOS There is a default my.cnf that comes with mysql (4+5) that will make mysql run a bit quicker if you have 2+ gig of ram cp -f \/usr\/share\/mysql\/my-large.cnf \/etc\/my.cnf There is also my-huge.cnf, or my-medium.cnf depending on your hardware setup. &nbsp; Check the contents of these my*.cnf files for the one that&#8217;s right [&hellip;]","og_url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/","og_site_name":"24x7serversupport Blog","article_published_time":"2020-06-06T11:37:36+00:00","article_modified_time":"2023-01-26T12:00:23+00:00","og_image":[{"width":1024,"height":536,"url":"https:\/\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png","type":"image\/png"}],"author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/","url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/","name":"How to Optimize MySQL | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#primaryimage"},"image":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1","datePublished":"2020-06-06T11:37:36+00:00","dateModified":"2023-01-26T12:00:23+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#primaryimage","url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1","width":1024,"height":536,"caption":"Optimize MySQL"},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-optimize-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Optimize MySQL"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/06\/MySQL-database-performance-tuning-tips-1024x536-1.png?fit=1024%2C536&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=3203"}],"version-history":[{"count":2,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3203\/revisions"}],"predecessor-version":[{"id":3558,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3203\/revisions\/3558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media\/3557"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=3203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=3203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=3203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}