MySQL/MariaDB Optimal settings for running on RaspberryPi 3 Model B


#1

This isn’t a question, but more of a share. I am running OwnCloud 10 on a Raspberry Pi and think I have come up with an ideal Mysql/MariaDB configuration for the limited hardware which I decided I should share in case anyone is looking for any pointers. Please note the OwnCloud usage may vary substantially and so this configuration might not necessarialy be the best for your use. In my installation for example there are only 2 user’s.

This is the contents of /etc/mysql/mariadb.conf.d/50-server.cnf:

[mysqld]

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

skip-name-resolve
performance_schema = ON

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

#
# * Fine Tuning
#
key_buffer_size         = 16M
max_allowed_packet      = 2M
thread_stack            = 192K
thread_cache_size       = 8
myisam_recover_options  = BACKUP
max_connections        = 20
table_cache            = 64
table_open_cache        = 144
thread_concurrency     = 10
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

#
# * Query Cache Configuration
#
query_cache_type        = 0
query_cache_size        = 0M
query_cache_limit       = 1M

#
# * Logging and Replication
#
log_error = /var/log/mysql/error.log
expire_logs_days        = 10
max_binlog_size   = 100M

#
# * InnoDB
#
innodb_buffer_pool_size = 80M
innodb_buffer_pool_instances = 1
innodb_additional_mem_pool_size = 2M

innodb_log_file_size = 8M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

innodb_large_prefix=true
innodb_file_format=barracuda
innodb_file_per_table=1
innodb_file_format_max=barracuda

#2

Thanks for sharing. :slight_smile: