Tune automatically by mysql tuner
official website https://github.com/major/MySQLTuner-perl
mysql tuner Installation
- Download the MySQLTuner script:
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
- Change the scripts permissions to be executable:
chmod +x mysqltuner.pl
- Run the
mysqltuner.pl
script. You will be prompted to enter in your MySQL administrative login and password:./mysqltuner.pl
- The script will return results similar to the output below:
root@localhost:/# ./mysqltuner.pl
>> MySQLTuner 1.9.4
* Jean-Marie Renouard <jmrenouard@gmail.com>
* 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
Please enter your MySQL administrative password: [OK] Currently running supported MySQL version 8.0.25
[OK] Operating on 64-bit architecture
——– Log file Recommendations ———————————————- ——————–
[OK] Log file /var/lib/mysql/localhost.err exists
[–] Log file: /var/lib/mysql/localhost.err(3K)
[OK] Log file /var/lib/mysql/localhost.err is not empty
[OK] Log file /var/lib/mysql/localhost.err is smaller than 32 Mb
[OK] Log file /var/lib/mysql/localhost.err is readable.
[!!] /var/lib/mysql/localhost.err contains 7 warning(s).
[OK] /var/lib/mysql/localhost.err doesn’t contain any error.
[–] 4 start(s) detected in /var/lib/mysql/localhost.err
[–] 1) 2021-06-01T07:00:43.413030Z 0 [System] [MY-010931] [Server] /usr/sbin/my sqld: ready for connections. Version: ‘8.0.25’ socket: ‘/var/run/mysqld/mysqld. sock’ port: 0 MySQL Community Server – GPL.
[–] 2) 2021-06-01T07:00:43.208875Z 0 [System] [MY-011323] [Server] X Plugin rea dy for connections. Socket: /var/run/mysqld/mysqlx.sock
[–] 3) 2021-06-01T06:35:03.850014Z 0 [System] [MY-010931] [Server] /usr/sbin/my sqld: ready for connections. Version: ‘8.0.25’ socket: ‘/var/run/mysqld/mysqld. sock’ port: 0 MySQL Community Server – GPL.
[–] 4) 2021-06-01T06:35:03.586233Z 0 [System] [MY-011323] [Server] X Plugin rea dy for connections. Socket: /var/run/mysqld/mysqlx.sock
[–] 2 shutdown(s) detected in /var/lib/mysql/localhost.err
[–] 1) 2021-06-01T07:08:42.473166Z 0 [System] [MY-010910] [Server] /usr/sbin/my sqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server – GPL.
[–] 2) 2021-06-01T06:58:59.012396Z 0 [System] [MY-010910] [Server] /usr/sbin/my sqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server – GPL.
——– Storage Engine Statistics ——————————————— ——————–
[–] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +My ISAM +PERFORMANCE_SCHEMA
[–] Data in MyISAM tables: 79.1M (Tables: 38)
[–] Data in InnoDB tables: 624.2M (Tables: 629)
[OK] Total fragmented tables: 0
——– Analysis Performance Metrics —————————————— ——————–
[–] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.
——– Views Metrics ——————————————————— ——————–
——– Triggers Metrics —————————————————— ——————–
——– Routines Metrics —————————————————— ——————–
——– Security Recommendations ———————————————- ——————–
[–] Skipped due to unsupported feature for MySQL 8
——– CVE Security Recommendations —————————————— ——————–
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION
——– Performance Metrics ————————————————— ——————–
[–] Up for: 1h 0m 21s (184K q [50.977 qps], 1K conn, TX: 31G, RX: 108M)
[–] Reads / Writes: 95% / 5%
[–] Binary logging is enabled (GTID MODE: OFF)
[–] Physical Memory : 7.8G
[–] Max MySQL memory : 9.8G
[–] Other process memory: 0B
[–] Total buffers: 168.0M global + 65.1M per thread (151 max threads)
[–] P_S Max memory usage: 72B
[–] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 689.2M (8.66% of installed RAM)
[!!] Maximum possible memory usage: 9.8G (125.74% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/184K)
[OK] Highest usage of available connections: 5% (8/151)
[OK] Aborted connections: 0.17% (3/1761)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[–] Query cache have been removed in MySQL 8
[OK] Sorts requiring temporary tables: 3% (921 temp sorts / 28K sorts)
[OK] No joins without indexes
[OK] Temporary tables created on disk: 0% (0 on disk / 5K total)
[OK] Thread cache hit rate: 99% (8 created / 1K connections)
[OK] Table cache hit rate: 98% (242K hits / 245K requests)
[OK] table_definition_cache(2000) is upper than number of tables(991)
[OK] Open file limit used: 0% (169/30K)
[OK] Table locks acquired immediately: 100% (2K immediate / 2K locks)
[OK] Binlog cache memory access: 99.05% (5853 Memory / 5909 Total)
——– Performance schema —————————————————- ——————–
[–] Performance_schema is activated.
[–] Memory used by P_S: 72B
[–] Sys schema is installed.
——– ThreadPool Metrics —————————————————- ——————–
[–] ThreadPool stat is disabled.
——– MyISAM Metrics ——————————————————– ——————–
[–] MyISAM Metrics are disabled on last MySQL versions.
——– InnoDB Metrics ——————————————————– ——————–
[–] InnoDB is enabled.
[–] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 128.0M/624.2M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128. 0M should be equal to 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: 99.88% (190217499 hits/ 190436985 total)
[!!] InnoDB Write Log efficiency: 60.73% (47529 hits/ 78265 total)
[OK] InnoDB log waits: 0.00% (0 waits / 30736 writes)
——– Aria Metrics ———————————————————- ——————–
[–] Aria Storage Engine not available.
——– TokuDB Metrics ——————————————————– ——————–
[–] TokuDB is disabled.
——– XtraDB Metrics ——————————————————– ——————–
[–] XtraDB is disabled.
——– Galera Metrics ——————————————————– ——————–
[–] Galera is disabled.
——– Replication Metrics ————————————————— ——————–
[–] Galera Synchronous replication: NO
[–] No replication slave(s) for this server.
[–] Binlog format: ROW
[–] XA support enabled: ON
[–] Semi synchronous replication Master: Not Activated
[–] Semi synchronous replication Slave: Not Activated
[–] This is a standalone server
——– Recommendations ——————————————————- ——————–
General recommendations:
Check warning line(s) in /var/lib/mysql/localhost.err file
MySQL was started within the last 24 hours – recommendations may be inaccura te
Reduce your overall MySQL memory footprint for system stability
Dedicate this server to your database for highest performance.
Configure your accounts with ip or subnets only, then update your configurat ion with skip-name-resolve=1
Before changing innodb_log_file_size and/or innodb_log_files_in_group read t his: https://bit.ly/2TcGgtU
Variables to adjust:
*** MySQL’s maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables *** //mysql memory usage
innodb_buffer_pool_size (>= 624.2M) 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:/#