Key settings
[mysqld]
# ── InnoDB ────────────────────────────────────────────────────────────
innodb_buffer_pool_size = 4G
innodb_buffer_pool_instances = 4
innodb_log_file_size = 512M
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_io_capacity = 2000 # IOPS of storage
# ── Thread pool (MariaDB-specific, improves concurrency) ──────────────
thread_handling = pool-of-threads
thread_pool_size = 32
thread_pool_max_threads = 1000
# ── Query cache (beneficial for read-heavy workloads on MariaDB) ──────
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 2M
# ── Temp tables ────────────────────────────────────────────────────────
tmp_table_size = 128M
max_heap_table_size = 128M
# ── Connections ────────────────────────────────────────────────────────
max_connections = 500
wait_timeout = 600
interactive_timeout = 600
# ── Slow query log ─────────────────────────────────────────────────────
slow_query_log = 1
long_query_time = 0.5
log_queries_not_using_indexes = 1
Restart MariaDB
systemctl restart mariadb 2>/dev/null || rc-service mariadb restart 2>/dev/null || rcctl restart mysqld
Use mysqltuner for recommendations
curl -Lo mysqltuner.pl https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
perl mysqltuner.pl --user root --pass RootPass!