MySQLTunner 는 MySQL 설치를 빠르게 검토하고 성능과 안전성을 높이기 위해 조정할 수 있는 Perl로 작성된 스크립트이다.
현재 구성 변수 및 상태 데이터가 검색되어 몇가지 기본 성능 제안 함께 간단한 형식으로 표시된다.
MySQLTuner는 이 마지막 버전에서 MySQL/MariaDB/Percona Server에 대해 ~300개의 표시기를 지원합니다.
0.사전 환경
OS : CentOS 7.7
Database : MySQL 5.7
[root:LEE:/root > cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
mysql> status
--------------
mysql Ver 14.14 Distrib 5.7.33, for linux-glibc2.12 (x86_64) using EditLine wrapper
Connection id: 1448
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.33-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /tmp/mysql.sock
Uptime: 1 day 20 hours 47 min 10 sec
Threads: 1 Questions: 3014024 Slow queries: 0 Opens: 1278 Flush tables: 2 Open tables: 927 Queries per second avg: 18.693
--------------
[root:LEE:/root > cat /etc/my5.7.cnf
[mysqld]
basedir=/mysql5.7
user=mysql
datadir=/data/data5.7
socket=/tmp/mysql.sock
port=3306
server-id=1
log-bin=/data/data5.7/binlog
relay-log=/log/log5.7/relaylog
relay_log_purge=0
# Disabling symbolic-links is recommended to prevent assorted security risks
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
log-error=/log/log5.7/mariadb.log
pid-file=/log/log5.7/mariadb.pid
query_cache_type = ON
[mysqld_safe]
basedir=/mysql5.7
user=mysql
port=3306
datadir=/data/data5.7
socket=/tmp/mysql.sock
log-error=/log/log5.7/mariadb.log
pid-file=/log/log5.7/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[root:LEE:/root > perl mysqltuner.pl
>> MySQLTuner 1.8.1 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root ## Adminuser
Please enter your MySQL administrative password: ## Password
2) 디버깅 없이 모든 환경 설정을 점검하는 명령어
* 해당 명령어는 많은 내용이 출력되기 때문에 output 을 지정하여 파일로 저장해서 봐야한다.