Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Learn how to configure MariaDB Server. This section covers essential configuration options, system variables, and best practices for tuning your database for optimal performance and security.
Explains the concept of atomic writes in MariaDB, which improve performance and data integrity on SSDs by bypassing the InnoDB doublewrite buffer, supported on devices like Fusion-io and Shannon SSDs.
innodb_doublewrite--an Imperfect Solutioninnodb_doublewriteinnodb_use_atomic_writes = 1
Guidance on tuning Linux kernel settings for MariaDB performance, including I/O schedulers (using `none` or `mq-deadline`), open file limits, and core file sizes.
cat /sys/block/${DEVICE}/queue/schedulercat /sys/block/vdb/queue/scheduler
[none] mq-deadline kyber bfqcat /sys/block/sda/queue/scheduler
[noop] deadline cfqecho noop > /sys/block/vdb/queue/schedulermysql soft nofile 65535
mysql hard nofile 65535$ ulimit -Sn
65535
$ ulimit -Hn
65535mysql soft core unlimited
mysql hard core unlimited$ ulimit -Sc
unlimited
$ ulimit -Hc
unlimitedIntroduction to using Fusion-io flash memory cards with MariaDB to significantly boost I/O throughput and reduce latency, including benefits like atomic write support.
sysctl vm.swappinessvm.swappiness = 0sysctl -w vm.swappiness=0vm.swappiness = 1Complete MariaDB environment variables: MYSQL_HOME, LD_PRELOAD, my.cnf search path precedence, and interaction with option files/command-line options.
MariaDB [test]> show global status like "Aria%";+-----------------------------------+-------+
| Variable_name | Value |
+-----------------------------------+-------+
| Aria_pagecache_blocks_not_flushed | 0 |
| Aria_pagecache_blocks_unused | 964 |
| Aria_pagecache_blocks_used | 232 |
| Aria_pagecache_read_requests | 9598 |
| Aria_pagecache_reads | 0 |
| Aria_pagecache_write_requests | 222 |
| Aria_pagecache_writes | 0 |
| Aria_transaction_log_syncs | 0 |
+-----------------------------------+-------+MariaDB [test]> show global status like "Created%tables%";+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| Created_tmp_disk_tables | 1 |
| Created_tmp_tables | 2 |
+-------------------------+-------+
Dive into advanced configurations for MariaDB Server performance. This section covers in-depth tuning parameters, optimization strategies, and best practices to maximize speed and efficiency.
Complete guide to MariaDB option files. Complete my.cnf reference with configuration groups, parameter syntax, and file hierarchy for production use.
MYSQL_HOMEmysqld.exemysqld.exeC:\Program Files\INSTALLDIRC:\Program Files\$program --help --verbose$ mariadbd --help --verbose
mariadbd Ver 10.11.2-MariaDB for linux-systemd on x86_64 (MariaDB Server)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Starts the MariaDB database server.
Usage: mariadbd [OPTIONS]
Default options are read from the following files in the given order:
/etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-10.11 mariadb mariadb-10.11 mariadbd mariadbd-10.11 client-server galera
....echo %WINDIR%/etc/my.cnf.d/mariadb-enterprise.cnf$program --help --verbose$ mariadbd --help --verbose
mariadbd Ver 10.11.2-MariaDB for linux-systemd on x86_64 (MariaDB Server)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Starts the MariaDB database server.
Usage: mariadbd [OPTIONS]
Default options are read from the following files in the given order:
/etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-10.11 mariadb mariadb-10.11 mariadbd mariadbd-10.11 client-server galera
....[client_custom_group]
prompt='(custom prompt for mariadb client)'mariadb --defaults-group-suffix=_custom_group[mariadb]
...
!include /etc/mysql/dbserver1.cnf[mariadb]
...
!includedir /etc/my.cnf.d/$ mariadb-dump --print-defaults
mariadb-dump would have been started with the following arguments:
--ssl_cert=/etc/my.cnf.d/certificates/client-cert.pem --ssl_key=/etc/my.cnf.d/certificates/client-key.pem --ssl_ca=/etc/my.cnf.d/certificates/ca.pem --ssl-verify-server-cert --max_allowed_packet=1G$ my_print_defaults mariadb-dump client client-server client-mariadb
--ssl_cert=/etc/my.cnf.d/certificates/client-cert.pem
--ssl_key=/etc/my.cnf.d/certificates/client-key.pem
--ssl_ca=/etc/my.cnf.d/certificates/ca.pem
--ssl-verify-server-cert
--max_allowed_packet=1GB$ my_print_defaults --mysqld
--log_bin=mariadb-bin
--log_slave_updates=ON
--ssl_cert=/etc/my.cnf.d/certificates/server-cert.pem
--ssl_key=/etc/my.cnf.d/certificates/server-key.pem
--ssl_ca=/etc/my.cnf.d/certificates/ca.pemSELECT VARIABLE_NAME, GLOBAL_VALUE, GLOBAL_VALUE_PATH
FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES
WHERE VARIABLE_NAME = 'innodb_buffer_pool_size'; -- replace with your variableSELECT VARIABLE_NAME, GLOBAL_VALUE, GLOBAL_VALUE_PATH
FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES
WHERE GLOBAL_VALUE_PATH IS NOT NULL;[mariadb]
...
# determine a good value for open_files_limit automatically
autoset_open_files_limit
# disable the unix socket plugin
disable_unix_socket
# enable the slow query log
enable_slow_query_log
# don't produce an error if these options don't exist
loose_file_key_management_filename = /etc/mysql/encryption/keyfile.enc
loose_file_key_management_filekey = FILE:/etc/mysql/encryption/keyfile.key
loose_file_key_management_encryption_algorithm = AES_CTR
# set max_allowed_packet to maximum value
maximum_max_allowed_packet
# disable external locking for MyISAM
skip_external_locking[mariadbd]
debug-no-sync
debug_no_syncmariadbd --debug-no-sync
mariadbd --debug_no_syncMariaDB [(none)]> SELECT @debug_no_sync;
+----------------+
| @debug_no_sync |
+----------------+
| NULL |
+----------------+
1 row in set (0.002 sec)
MariaDB [(none)]> SELECT @debug-no-sync;
ERROR 1054 (42S22): Unknown column 'no' in 'SELECT'[client-server]
# Uncomment these if you want to use a nonstandard connection to MariaDB
#socket=/tmp/mysql.sock
#port=3306
# This will be passed to all MariaDB clients
[client]
#password=my_password
# The MariaDB server
[mysqld]
# Directory where you want to put your data
data=/usr/local/mysql/var
# Directory for the errmsg.sys file in the language you want to use
language=/usr/local/share/mysql/english
# This is the prefix name to be used for all log, error and replication files
log-basename=mysqld
# Enable logging by default to help find problems
general-log
log-slow-queries# Example mysql config file.
[client-server]
socket=/tmp/mysql-dbug.sock
port=3307
# This will be passed to all mariadb clients
[client]
password=my_password
# Here are entries for some specific programs
# The following values assume you have at least 32M ram
# The MariaDB server
[mysqld]
temp-pool
key_buffer_size=16M
datadir=/my/mysqldata
loose-innodb_file_per_table
[mariadb]
datadir=/my/data
default-storage-engine=aria
loose-mutex-deadlock-detector
max-connections=20
[mariadb-5.5]
language=/my/maria-5.5/sql/share/english/
socket=/tmp/mysql-dbug.sock
port=3307
[mariadb-10.1]
language=/my/maria-10.1/sql/share/english/
socket=/tmp/mysql2-dbug.sock
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
loose-abort-source-on-error