Last active
January 21, 2025 01:51
-
-
Save khoipro/7632dfa467a46bab0f8b9d2bf9f0cd7d to your computer and use it in GitHub Desktop.
Tweak MySQL for better performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CPU = 4 | |
# RAM = 8GB | |
# Website = WordPress, WooCommerce, >1k products | |
# Cache = W3 Total Cache | |
[mysql] | |
port = 3306 | |
[mysqld] | |
performance_schema = ON | |
skip-name-resolve = 1 | |
bind-address = 0.0.0.0 | |
general_log_file = /var/log/mysql/mysql.log | |
general_log = 0 | |
# Default MySQL character set and collation | |
# See: https://coderwall.com/p/xdrjxg/proper-mysql-character-set-and-collation-setup | |
character-set-server = utf8mb4 | |
collation-server = utf8mb4_unicode_ci | |
skip-character-set-client-handshake | |
max_connections = 200 | |
max_connect_errors = 10 | |
connect_timeout = 5 | |
max_allowed_packet = 16M | |
thread_cache_size = 128 | |
tmp_table_size = 128M | |
max_heap_table_size = 128M | |
table_open_cache = 2048 | |
table_definition_cache = 2048 | |
key_buffer_size = 128M | |
join_buffer_size = 512K | |
# Query Cache | |
query_cache_limit = 128K | |
query_cache_size = 0 | |
query_cache_type = 0 | |
# Log | |
slow_query_log = 0 | |
slow_query_log_file = /var/log/mysql/mariadb-slow.log | |
long_query_time = 3 | |
log_slow_rate_limit = 100 | |
log_slow_verbosity = query_plan | |
# InnoDB | |
default_storage_engine = InnoDB | |
innodb_log_file_size = 1024M | |
innodb_buffer_pool_size = 4G | |
innodb_log_buffer_size = 64M | |
[mysqldump] | |
quick | |
max_allowed_packet = 16M | |
[isamchk] | |
key_buffer = 16M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment