Конфиг для 10-и гигабайтного (оперативной памяти) сервера.
Лень разбирать, но то что долгие годы стабильно работает, оставлю на память здесь.
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
symbolic-links=0
skip-external-locking
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_concurrency = 8
interactive_timeout=50
# slow_query_log=1
# innodb_use_native_aio = 0
# new
slow_query_log_file=/var/log/mysql-slow-queries.log
max_binlog_size = 2M
expire_logs_days = 15
key_buffer_size = 16M
max_allowed_packet = 16M
max_connections = 160
thread_cache_size = 160
long_query_time = 1
wait_timeout = 30
max_user_connections = 60
innodb_buffer_pool_size = 5120M
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
# was
# slow_query_log_file=/var/log/mysql-slow-queries.log
# key_buffer_size = 256M
# max_allowed_packet = 32M
# max_connections=200
# thread_cache_size = 8
# query_cache_size= 16M
# long_query_time=5
# wait_timeout=10
# max_user_connections=50
# innodb_file_per_table
# include all files from the config directory
!includedir /etc/my.cnf.d
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
symbolic-links=0
skip-external-locking
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_concurrency = 8
interactive_timeout=50
# slow_query_log=1
# innodb_use_native_aio = 0
# new
slow_query_log_file=/var/log/mysql-slow-queries.log
max_binlog_size = 2M
expire_logs_days = 15
key_buffer_size = 16M
max_allowed_packet = 16M
max_connections = 160
thread_cache_size = 160
long_query_time = 1
wait_timeout = 30
max_user_connections = 60
innodb_buffer_pool_size = 5120M
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
# was
# slow_query_log_file=/var/log/mysql-slow-queries.log
# key_buffer_size = 256M
# max_allowed_packet = 32M
# max_connections=200
# thread_cache_size = 8
# query_cache_size= 16M
# long_query_time=5
# wait_timeout=10
# max_user_connections=50
# innodb_file_per_table
# include all files from the config directory
!includedir /etc/my.cnf.d