{"id":469,"date":"2014-07-30T23:27:12","date_gmt":"2014-07-30T23:27:12","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=469"},"modified":"2014-07-30T23:27:12","modified_gmt":"2014-07-30T23:27:12","slug":"using-mysqltuner","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/30\/using-mysqltuner\/","title":{"rendered":"Using Mysqltuner"},"content":{"rendered":"<p><strong>Download\/Installation<\/strong><br \/>\nSimple<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nwget https:\/\/raw.githubusercontent.com\/major\/MySQLTuner-perl\/master\/mysqltuner.pl\n# chmod +x mysqltuner.pl\n# .\/mysqltuner.pl\n<\/pre>\n<p>You can download the entire repository by using &#8216;git clone&#8217; followed by the cloning URL above. The simplest and shortest method is:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">wget mysqltuner.pl\nperl mysqltuner.pl\n\n<\/pre>\n<p>Change the permissions you can execute it without calling perl directly.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# chmod +x mysqltuner.pl\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# .\/mysqltuner.pl\n\n &amp;gt;&amp;gt;  MySQLTuner 1.2.0 - Major Hayden &amp;lt;major@mhtx.net&amp;gt;\n &amp;gt;&amp;gt;  Bug reports, feature requests, and downloads at http:\/\/mysqltuner.com\/\n &amp;gt;&amp;gt;  Run with &#039;--help&#039; for additional options and output filtering\n\n-------- General Statistics --------------------------------------------------\n&#x5B;--] Skipped version check for MySQLTuner script\n&#x5B;OK] Currently running supported MySQL version 5.1.73-log\n&#x5B;OK] Operating on 64-bit architecture\n\n-------- Storage Engine Statistics -------------------------------------------\n&#x5B;--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster\n&#x5B;--] Data in MyISAM tables: 4M (Tables: 230)\n&#x5B;--] Data in InnoDB tables: 12M (Tables: 419)\n&#x5B;--] Data in MEMORY tables: 0B (Tables: 2)\n&#x5B;!!] Total fragmented tables: 423\n\n-------- Security Recommendations  -------------------------------------------\n&#x5B;OK] All database users have passwords assigned\n\n-------- Performance Metrics -------------------------------------------------\n&#x5B;--] Up for: 16s (25 q &#x5B;1.562 qps], 8 conn, TX: 62K, RX: 1K)\n&#x5B;--] Reads \/ Writes: 93% \/ 7%\n&#x5B;--] Total buffers: 58.0M global + 1.6M per thread (151 max threads)\n&#x5B;OK] Maximum possible memory usage: 303.4M (3% of installed RAM)\n&#x5B;OK] Slow queries: 0% (0\/25)\n&#x5B;OK] Highest usage of available connections: 0% (1\/151)\n&#x5B;OK] Key buffer size \/ total MyISAM indexes: 16.0M\/1.1M\n&#x5B;!!] Key buffer hit rate: 77.6% (98 cached \/ 22 reads)\n&#x5B;!!] Query cache is disabled\n&#x5B;OK] Sorts requiring temporary tables: 0% (0 temp sorts \/ 2 sorts)\n&#x5B;OK] Temporary tables created on disk: 20% (1 on disk \/ 5 total)\n&#x5B;!!] Thread cache is disabled\n&#x5B;OK] Table cache hit rate: 68% (15 open \/ 22 opened)\n&#x5B;OK] Open file limit used: 3% (32\/1K)\n&#x5B;OK] Table locks acquired immediately: 100% (29 immediate \/ 29 locks)\n&#x5B;!!] Connections aborted: 25%\n&#x5B;OK] InnoDB data size \/ buffer pool: 12.1M\/16.0M\n\n<\/pre>\n<p>[stextbox id=&#8221;warning&#8221;]&#8212;&#8212;&#8211; Recommendations &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;[\/stextbox]<\/p>\n<p>General recommendations:<br \/>\nRun OPTIMIZE TABLE to defragment tables for better performance<br \/>\nMySQL started within last 24 hours &#8211; recommendations may be inaccurate<br \/>\nEnable the slow query log to troubleshoot bad queries<br \/>\nSet thread_cache_size to 4 as a starting value<br \/>\nYour applications are not closing MySQL connections properly<br \/>\nVariables to adjust:<br \/>\nquery_cache_size (&gt;= 8M)<br \/>\nthread_cache_size (start at 4)<\/p>\n<p>&nbsp;<\/p>\n<p>Optimize tables<\/p>\n<p>See &#8211;\u00a0<a href=\"https:\/\/qbytes.cloud\/mysql-checkrepair-database\/\" target=\"_blank\" rel=\"noopener\">https:\/\/qbytes.cloud\/mysql-checkrepair-database\/<\/a><\/p>\n<p>Enable the slow query log to troubleshoot bad queries<br \/>\nSet thread_cache_size to 4 as a starting value<br \/>\nquery_cache_size (&gt;= 8M)<br \/>\nthread_cache_size (start at 4)<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# nano \/etc\/my.cnf\n\n&#x5B;mysqld]\nport            = 3306\nsocket          = \/var\/lib\/mysql\/mysql.sock\nskip-locking\nkey_buffer_size = 16M\nmax_allowed_packet = 1M\ntable_open_cache = 64\nsort_buffer_size = 512K\nnet_buffer_length = 8K\nread_buffer_size = 256K\nread_rnd_buffer_size = 512K\nmyisam_sort_buffer_size = 8M\ninteractive_timeout=1800\nwait_timeout=1800\n<\/pre>\n<p>Add the following if mysql is 5.6.1 or higher<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">slow_query_log = 1;\nslow_query_log_file = &#039;\/var\/log\/mysql-slow.log&#039;;\nquery_cache_type = 1\nquery_cache_size = 32M\nthread_cache_size = 4\n<\/pre>\n<p>Other links and Info:<\/p>\n<p>I would recommend making sure the following is optimized.<\/p>\n<p>Your mysql queries in your code to make sure the queries are being closed.<br \/>\nYour mysql tables are optimized.<br \/>\nYour mysql configuration is optimized for your web site needs.<\/p>\n<p>Here are some helpful links on mysql optimization.<\/p>\n<p><a href=\"http:\/\/www.codero.com\/knowledge-base\/questions\/319\/How+to+install+mytop+for+database+performance+monitoring%3A\" target=\"_blank\" rel=\"noopener\">http:\/\/www.codero.com\/knowledge-base\/questions\/319\/How+to+install+mytop+for+database+performance+monitoring%3A<\/a><br \/>\n<a href=\"http:\/\/www.codero.com\/knowledge-base\/questions\/298\/How+can+I+view+currently+running+MySQL+queries%3F\" target=\"_blank\" rel=\"noopener\">http:\/\/www.codero.com\/knowledge-base\/questions\/298\/How+can+I+view+currently+running+MySQL+queries%3F<\/a><br \/>\n<a href=\"http:\/\/www.codero.com\/knowledge-base\/questions\/274\/How+to+check+and+repair+MySQL+database+tables\" target=\"_blank\" rel=\"noopener\">http:\/\/www.codero.com\/knowledge-base\/questions\/274\/How+to+check+and+repair+MySQL+database+tables<\/a><br \/>\n<a href=\"http:\/\/www.codero.com\/knowledge-base\/questions\/96\/How+do+I+optimze+mysql%3F\" target=\"_blank\" rel=\"noopener\">http:\/\/www.codero.com\/knowledge-base\/questions\/96\/How+do+I+optimze+mysql%3F<\/a><br \/>\n<a href=\"http:\/\/www.codero.com\/knowledge-base\/questions\/195\/How+can+I+trouble+shoot+my+MySQL+database%3F\" target=\"_blank\" rel=\"noopener\">http:\/\/www.codero.com\/knowledge-base\/questions\/195\/How+can+I+trouble+shoot+my+MySQL+database%3F<\/a><br \/>\n<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/optimization.html\" target=\"_blank\" rel=\"noopener\">http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/optimization.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download\/Installation Simple wget https:\/\/raw.githubusercontent.com\/major\/MySQLTuner-perl\/master\/mysqltuner.pl # chmod +x mysqltuner.pl # .\/mysqltuner.pl You can download the entire repository by using &#8216;git clone&#8217; followed by the cloning URL above. The simplest and shortest method is: wget mysqltuner.pl perl mysqltuner.pl Change the permissions you can execute it without calling perl directly. &#x5B;root@austin ~]# chmod +x mysqltuner.pl &#x5B;root@austin ~]# .\/mysqltuner.pl &#8230; <a title=\"Using Mysqltuner\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/30\/using-mysqltuner\/\" aria-label=\"Read more about Using Mysqltuner\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,70],"tags":[],"class_list":["post-469","post","type-post","status-publish","format-standard","hentry","category-administration","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=469"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/469\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}