<

[Webinar] Streamline your web hosting managementRegister Today

x

USING MYSQLTUNER

Published on
67 Points
67 Views
Last Modified:
MySQLTuner is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief format along with some basic performance suggestions.

REQUIREMENTS

Before you start, you'll need the following:


IMPORTANT NOTICE

The MySQLTuner script will make suggestions for changes you can make to your server to optimize your MySQL services. Media Temple does not support any suggested configuration changes. We encourage you to back up your service before making any of the changes recommended by the script.


This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by Media Temple. Please take a moment to review the Statement of Support. Please consult the MySQLTuner blog for further assistance.


INSTRUCTIONS

  1. Log into your server with a root or sudo user via SSH.
  2. Download MySQLTuner by executing the following command:
    wget -O mysqltuner.pl https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl --no-check-certificate
  3. Give the script 775 permissions:
    chmod 775 mysqltuner.pl
  4. Run the script with the following command:
    perl mysqltuner.pl
  5. The script should run and then display statistics and recommendations. Sample output:
    >>  MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net> >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/ >>  Run with '--help' for additional options and output filtering 
    -------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.0.77 [OK] Operating on 32-bit architecture with less than 2GB RAM 
    -------- Storage Engine Statistics ------------------------------------------- [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 122K (Tables: 99) [--] Data in InnoDB tables: 52M (Tables: 155) [!!] Total fragmented tables: 5 
    -------- Performance Metrics ------------------------------------------------- [--] Up for: 262d 23h 58m 26s (2M q [0.121 qps], 328K conn, TX: 572M, RX: 207M) [--] Reads / Writes: 66% / 34% [--] Total buffers: 35.0M global + 2.7M per thread (100 max threads) [OK] Maximum possible memory usage: 303.7M (45% of installed RAM) [OK] Slow queries: 0% (3/2M) [OK] Highest usage of available connections: 5% (5/100) [OK] Key buffer size / total MyISAM indexes: 8.0M/401.0K [!!] Key buffer hit rate: 93.9% (110K cached / 6K reads) [OK] Query cache efficiency: 82.8% (932K cached / 1M selects) [OK] Query cache prunes per day: 11 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 29K sorts) [OK] Temporary tables created on disk: 25% (88K on disk / 348K total) [!!] Thread cache is disabled [!!] Table cache hit rate: 0% (64 open / 184K opened) [OK] Open file limit used: 8% (86/1K) [OK] Table locks acquired immediately: 100% (339K immediate / 339K locks) [!!] InnoDB data size / buffer pool: 52.6M/2.0M 
    -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Enable the slow query log to troubleshoot bad queries Set thread_cache_size to 4 as a starting value Increase table_cache gradually to avoid file descriptor limits Variables to adjust: thread_cache_size (start at 4) table_cache (> 64) innodb_buffer_pool_size (>= 52M)
    
  6. Feel free to implement these suggestions at your own discretion.


For more tips, visit Media Temple's Support Community.


If you haven't already ordered your new DV server from Media Temple, click here to do that now.

0
Comment
0 Comments

Join & Write a Comment

In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month