MySQLTuner的介紹

psufnxk2000發表於2015-12-07
可以快速的review mysql 的安裝 ,並提出優化的建議:
可以在http://mysqltuner.com/ 下載


使用的時候遇到的問題:

# perl mysqltuner.pl
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [!!]  Attempted to use login credentials, but they were invalid.
mysql程式是在的,
通過root可以登陸,並且有許可權。
通過檢視perl指令碼:
原來他要這樣
 mysqladmin  ping -uroot -ptest
Warning: Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
使用ln -s 建立連線
ln -s  /opt/data/5907bf0512dc/mysqld.sock /tmp/mysql.sock
mysqladmin  ping -uroot -ptest
Warning: Using a password on the command line interface can be insecure.
mysqld is alive



內容的格式如下:

-------- Performance Metrics ------------------------------------------------- 
[--] Up for: 1h 7m 45s (1K q [0.469 qps], 642 conn, TX: 234K, RX: 285K) 
[--] Reads / Writes: 100% / 0% 
[--] Binary logging is enabled (GTID MODE: ON) 
[--] Total buffers: 5.0G global + 13.3M per thread (151 max threads) 
[!!] Maximum reached memory usage: 5.1G (266.65% of installed RAM) 
[!!] Maximum possible memory usage: 7.0G (368.77% of installed RAM) 
[OK] Slow queries: 0% (0/1K) 
[OK] Highest usage of available connections: 1% (2/151) 
[OK] Aborted connections: 0.31% (2/642) 
[!!] Query cache is disabled 
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 2 sorts) 
[OK] Temporary tables created on disk: 0% (0 on disk / 19 total) 
[OK] Thread cache hit rate: 99% (2 created / 642 connections) 
[!!] Table cache hit rate: 1% (4 open / 388 opened) 
[OK] Open file limit used: 0% (5/5K) 
[OK] Table locks acquired immediately: 100% (683 immediate / 683 locks) 
[OK] Binlog cache memory access: 0% ( 0 Memory / 0 Total) 

-------- MyISAM Metrics ----------------------------------------------------- 
[!!] Key buffer used: 18.8% (3K used / 16K cache) 
[!!] Key buffer size / total MyISAM indexes: 16.0K/98.0K 
[!!] Read Key buffer hit rate: 83.3% (6 cached / 1 reads) 

-------- InnoDB Metrics ----------------------------------------------------- 
[--] InnoDB is enabled. 
[OK] InnoDB buffer pool / data size: 5.0G/176.0K 
[!!] InnoDB buffer pool instances: 8 
[!!] InnoDB Used buffer: 0.13% (424 used/ 327676 total) 
[OK] InnoDB Read buffer efficiency: 96.61% (12122 hits/ 12547 total) 
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total) 
[OK] InnoDB log waits: 0.00% (0 waits / 1 writes) 

-------- AriaDB Metrics ----------------------------------------------------- 
[--] AriaDB is disabled. 

-------- Replication Metrics ------------------------------------------------- 
[--] No replication slave(s) for this server. 
[--] This is a standalone server.. 

-------- Recommendations ----------------------------------------------------- 
General recommendations: 
Set up a Secure Password for user@host ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); ) 
Restrict Host for user@% to user@SpecificDNSorIp 
2 user(s) used basic or weaked password. 
MySQL started within last 24 hours - recommendations may be inaccurate 
Reduce your overall MySQL memory footprint for system stability 
Increase table_open_cache gradually to avoid file descriptor limits 
Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C 
Beware that open_files_limit (5000) variable 
should be greater than table_open_cache ( 4) 
Variables to adjust: 
*** MySQL's maximum memory usage is dangerously high *** 
*** Add RAM before increasing MySQL buffer variables *** 
query_cache_type (=1) 
table_open_cache (> 4) 
key_buffer_size (> 98.0K) 
innodb_buffer_pool_instances(=5) 



轉載請註明源出處 
QQ 273002188 歡迎一起學習 
QQ 群 236941212 
oracle,mysql,mongo 相互交流

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1867504/,如需轉載,請註明出處,否則將追究法律責任。