参考
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget -O MySQLTuner.zip https://github.com/rackerhacker/MySQLTuner-perl/archive/master.zip
--2018-07-04 12:29:52-- https://github.com/rackerhacker/MySQLTuner-perl/archive/master.zip
github.com (github.com) をDNSに問いあわせています... 192.30.255.113, 192.30.255.112
github.com (github.com)|192.30.255.113|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 301 Moved Permanently
--2018-07-04 12:29:53-- https://github.com/major/MySQLTuner-perl/archive/master.zip
github.com:443 への接続を再利用します。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
--2018-07-04 12:29:54-- https://codeload.github.com/major/MySQLTuner-perl/zip/master
codeload.github.com (codeload.github.com) をDNSに問いあわせています... 192.30.255.121, 192.30.255.120
codeload.github.com (codeload.github.com)|192.30.255.121|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 特定できません [application/zip]
`MySQLTuner.zip' に保存中
[ <=> ] 231,070 388KB/s 時間 0.6s
2018-07-04 12:29:55 (388 KB/s) - `MySQLTuner.zip' へ保存終了 [231070]
[root@localhost src]# unzip MySQLTuner.zip
Archive: MySQLTuner.zip
281559eb04f2c501f99cec7075a8794e1b506333
creating: MySQLTuner-perl-master/
inflating: MySQLTuner-perl-master/.gitignore
inflating: MySQLTuner-perl-master/.perltidy
inflating: MySQLTuner-perl-master/.travis.yml
inflating: MySQLTuner-perl-master/CODE_OF_CONDUCT.md
inflating: MySQLTuner-perl-master/CONTRIBUTING.md
inflating: MySQLTuner-perl-master/INTERNALS.md
inflating: MySQLTuner-perl-master/LICENSE
inflating: MySQLTuner-perl-master/README.fr.md
inflating: MySQLTuner-perl-master/README.it.md
inflating: MySQLTuner-perl-master/README.md
inflating: MySQLTuner-perl-master/README.ru.md
inflating: MySQLTuner-perl-master/USAGE.md
creating: MySQLTuner-perl-master/Vagrant/
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MariaDB10.0
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MariaDB10.1
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MariaDB10.2
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MariaDB10.3
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MySQL5-6
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MySQL5-7
inflating: MySQLTuner-perl-master/Vagrant/Vagrantfile_for_MySQL8-0
inflating: MySQLTuner-perl-master/Vagrant/prepare.sh
inflating: MySQLTuner-perl-master/basic_passwords.txt
creating: MySQLTuner-perl-master/build/
inflating: MySQLTuner-perl-master/build/build_rpm.sh
inflating: MySQLTuner-perl-master/build/clean.sh
inflating: MySQLTuner-perl-master/build/deployOn
inflating: MySQLTuner-perl-master/build/mysqltuner.spec.tpl
inflating: MySQLTuner-perl-master/build/updateCVElist.pl
inflating: MySQLTuner-perl-master/build/updateStaff.sh
inflating: MySQLTuner-perl-master/mysqltuner.pl
inflating: MySQLTuner-perl-master/mysqltuner.png
inflating: MySQLTuner-perl-master/template_example.tpl
inflating: MySQLTuner-perl-master/vulnerabilities.csv
[root@localhost src]# cd MySQLTuner-perl-master
[root@localhost MySQLTuner-perl-master]# chmod +x mysqltuner.pl
[root@localhost MySQLTuner-perl-master]# ./mysqltuner.pl
>> MySQLTuner 1.7.9 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: mariausr1
Please enter your MySQL administrative password:
[OK] Currently running supported MySQL version 10.3.8-MariaDB-log
[OK] Operating on 64-bit architecture
-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/lib/mysql/localhost.localdomain.err(0B)
[!!] Log file /var/lib/mysql/localhost.localdomain.err doesn't exist
[!!] Log file /var/lib/mysql/localhost.localdomain.err isn't readable.
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
[--] Data in InnoDB tables: 564M (Tables: 409)
[OK] Total fragmented tables: 0
-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] User 'mariausr1@%' does not specify hostname restrictions.
[--] There are 612 basic passwords in the list.
-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 2h 3m 6s (155 q [0.021 qps], 22 conn, TX: 88K, RX: 17K)
[--] Reads / Writes: 93% / 7%
[--] Binary logging is enabled (GTID MODE: OFF)
[--] Physical Memory : 3.2G
[--] Max MySQL memory : 1.5G
[--] Other process memory: 374.6M
[--] Total buffers: 560.0M global + 6.5M per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 573.1M (17.75% of installed RAM)
[OK] Maximum possible memory usage: 1.5G (47.91% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/155)
[OK] Highest usage of available connections: 1% (2/151)
[!!] Aborted connections: 9.09% (2/22)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 15 selects)
[OK] Query cache prunes per day: 0
[OK] No Sort requiring temporary tables
[OK] No joins without indexes
[OK] Temporary tables created on disk: 13% (12 on disk / 91 total)
[OK] Thread cache hit rate: 86% (3 created / 22 connections)
[OK] Table cache hit rate: 49% (256 open / 522 opened)
[OK] Open file limit used: 0% (24/16K)
[OK] Table locks acquired immediately: 100% (29 immediate / 29 locks)
[OK] Binlog cache memory access: 100.00% (1 Memory / 1 Total)
-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 4 thread(s).
[--] Using default value is good enough for your version (10.3.8-MariaDB-log)
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (48M used / 268M cache)
[OK] Key buffer size / total MyISAM indexes: 256.0M/123.0K
[!!] Read Key buffer hit rate: 0.0% (2 cached / 2 reads)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 128.0M/564.7M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
[OK] InnoDB buffer pool instances: 1
[--] Number of InnoDB Buffer Pool Chunk : 1 for 1 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 95.25% (28615 hits/ 30041 total)
[!!] InnoDB Write Log efficiency: 71.88% (1002 hits/ 1394 total)
[OK] InnoDB log waits: 0.00% (0 waits / 392 writes)
-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/1B
[OK] Aria pagecache hit rate: 99.0% (102 cached / 1 reads)
-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.
-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.
-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.
-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.
-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.
-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.
-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: MIXED
Use of uninitialized value $_[0] in concatenation (.) or string at
./mysqltuner.pl line 233 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl will try to tell you
the name of the variable (if any) that was undefined. In some cases
it cannot do this, so it also tells you what operation you used the
undefined value in. Note, however, that perl optimizes your program
anid the operation displayed in the warning may not necessarily appear
literally in your program. For example, "that $foo" is usually
optimized into "that " . $foo, and the warning will refer to the
concatenation (.) operator, even though there is no . in
your program.
[--]
[--] Semi synchronous replication Master: OFF
[--] Semi synchronous replication Slave: OFF
[--] This is a standalone server
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
Restrict Host for user@% to user@SpecificDNSorIp
MySQL was started within the last 24 hours - recommendations may be inaccurate
Reduce or eliminate unclosed connections and network issues
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
Performance schema should be activated for better diagnostics
Consider installing Sys schema from https://github.com/mysql/mysql-sys
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: http://bit.ly/2wgkDvS
Variables to adjust:
query_cache_size (=0)
query_cache_type (=0)
query_cache_limit (> 1M, or use smaller result sets)
performance_schema = ON enable PFS
innodb_buffer_pool_size (>= 564M) if possible.
innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
[root@localhost MySQLTuner-perl-master]#
[root@localhost MySQLTuner-perl-master]#