MariaDB – tuning


Some MySQL/MariaDB tuning that I use with modification in all of my database installations.

[mysqld] 

# * Fine Tuning 

key_buffer              = 256M 
max_allowed_packet      = 256M 
thread_stack            = 192K 
thread_cache_size       = 128 
join_buffer_size        = 2M # 1M for 1GB, 2M for 2GB, 4M for 4GB 
tmp_table_size          = 512M 
max_heap_table_size     = 256M 
# This replaces the startup script and checks MyISAM tables if needed 
# the first time they are touched 
myisam-recover          = BACKUP 
table_cache             = 1024 
max_connections         = 500 
# * InnoDB 
innodb_buffer_pool_size         = 1G   #70% of available memory 
innodb_buffer_pool_instances    = 1 
innodb_log_file_size            = 256M #25% of innodb_buffer_pool_size 
innodb_log_buffer_size          = 8M 
innodb_flush_log_at_trx_commit  = 1 
innodb_thread_concurrency       = 0 
#innodb_flush_method            = 
innodb_file_per_table           = ON 
# Slow log 
slow_query_log = 1 
slow_query_log_file = /var/log/mariadb/mysql-slow.log 
long_query_time = 10