- 代码: 全选
# wget http://mysqltuner.com/mysqltuner.pl #下载mysqltuner.pl脚本
# chmod +x ./mysqltuner.pl #修改为可执行
# ./mysqltuner.pl --sock=mysql.sock_path #mysql.sock_path为本地mysql的sock文件路径,更多信息可以使用./mysqltuner.pl --help查看
>> MySQLTuner 1.0.0 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: root #输入用户名和密码
Please enter your MySQL administrative password:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.45
[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: 7M (Tables: 469)
[--] Data in InnoDB tables: 5M (Tables: 59)
[--] Data in MEMORY tables: 0B (Tables: 1)
[!!] Total fragmented tables: 68
-------- Performance Metrics -------------------------------------------------
[--] Up for: 6d 17h 10m 33s (5M q [9.439 qps], 39K conn, TX: 182M, RX: 5B)
[--] Reads / Writes: 1% / 99%
[--] Total buffers: 42.0M global + 1.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 197.5M (9% of installed RAM)
[OK] Slow queries: 0% (1/5M)
[OK] Highest usage of available connections: 22% (22/100)
[OK] Key buffer size / total MyISAM indexes: 16.0M/4.6M
[OK] Key buffer hit rate: 99.7% (454K cached / 1K reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 4K sorts)
[!!] Joins performed without indexes: 4905
[OK] Temporary tables created on disk: 0% (79 on disk / 102K total)
[OK] Thread cache hit rate: 93% (2K created / 39K connections)
[!!] Table cache hit rate: 1% (64 open / 4K opened)
[OK] Open file limit used: 9% (95/1K)
[OK] Table locks acquired immediately: 99% (5M immediate / 5M locks)
[OK] InnoDB data size / buffer pool: 5.5M/8.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (>= 8M)
join_buffer_size (> 128.0K, or always use indexes with joins)
table_cache (> 64)
以上例子感叹号的位置表示需要您多注意,说明检测到某些信息期望您做优化,最后也会给出一些配置的调整建议,比较人性化,对快速优化MySql数据库有一定的帮助