1

Topic: MariaDB/Mysql Configuration Best Practice?

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.7.0 MARIADB edition.
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: Ubuntu 24.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

My iRedMail instance runs on an ARM64 server with 4 cores and 8 GB Ram - sufficient for our email volume.

I was wondering if there is a "best practice" guide for configuring MariaDB or Mysql. Wouldn't that also be something for a manual?

What should be improved in the attached configuration?

basedir=/usr
bind-address=127.0.0.1
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
datadir=/var/lib/mysql
expire_logs_days=7
innodb_buffer_pool_instances=4
innodb_buffer_pool_size=4G
innodb_file_per_table=1
innodb_flush_log_at_trx_commit=2
innodb_flush_method=O_DIRECT
innodb_io_capacity=400
innodb_log_buffer_size=64M
innodb_log_file_size=256M
innodb_open_files=400
innodb_read_io_threads=8
innodb_write_io_threads=8
join_buffer_size=2M
key_buffer_size=256M
log_bin=/var/log/mysql/mysql-bin.log
log_error=/var/log/mysql/error.log
log_queries_not_using_indexes=0
long_query_time=2
max_allowed_packet=512M
max_binlog_size=100M
max_connections=300
max_heap_table_size=64M
myisam_recover_options=backup
myisam_sort_buffer_size=64M
open_files_limit=65535
pid-file=/run/mysqld/mysqld.pid
slow_query_log=1
slow_query_log_file=/var/log/mysql/mariadb-slow.log
socket=/run/mysqld/mysqld.sock
sort_buffer_size=4M
sync_binlog=1
table_open_cache=8102
thread_cache_size=128
thread_stack=256K
tmpdir=/tmp
tmp_table_size=64M
user=mysql

Many thanks in advance. As you will have noticed, I am not a database expert...

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.