1,下载
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl -o mysqltuner.pl
2,运行
perl mysqltuner.pl
3,结果
[OK] Currently running supported MySQL version 5.5.41-0ubuntu0.14.04.1
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MEMORY tables: 372K (Tables: 18)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in InnoDB tables: 5M (Tables: 314)
[--] Data in MyISAM tables: 656K (Tables: 321)
[!!] Total fragmented tables: 314
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 3h 47m 55s (34K q [2.522 qps], 552 conn, TX: 14M, RX: 7M)
[--] Reads / Writes: 52% / 48%
[--] Total buffers: 192.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 597.8M (15% of installed RAM)
[OK] Slow queries: 0% (0/34K)
[OK] Highest usage of available connections: 3% (5/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/1.2M
[OK] Key buffer hit rate: 99.9% (106K cached / 156 reads)
[OK] Query cache efficiency: 54.5% (9K cached / 17K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 596 sorts)
[!!] Joins performed without indexes: 144
[OK] Temporary tables created on disk: 21% (1K on disk / 5K total)
[OK] Thread cache hit rate: 99% (5 created / 552 connections)
[!!] Table cache hit rate: 15% (400 open / 2K opened)
[OK] Open file limit used: 31% (319/1K)
[OK] Table locks acquired immediately: 100% (19K immediate / 19K locks)
[OK] InnoDB buffer pool / data size: 128.0M/5.0M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
Increase table_open_cache gradually to avoid file descriptor limits
Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
join_buffer_size (> 128.0K, or always use indexes with joins)
table_open_cache (> 400)