In addition to the formal documentation (i.e. https://mariadb.com/resources/blog/installing-mariadb-10-centos-7-rhel-7, etc), there are countless tutorials on installing MariaDB, however, not one of them goes on to say that additional steps maybe be needed for the specific installation requirements. Is the next unwritten and assumed step to modify /etc/my.cnf as needed? When I set out to do so, I am surprise to find that mine is practically empty unlike the typical long winded configuration files with various configuration settings commented out. Is this /etc/my.cnf file the one I should be editing, or is this some common MySQL/MariaDB file and there is some other MariaDB specific file located elsewhere? Or is there potentially no configuration file as https://mariadb.com/kb/en/library/configuring-mariadb-with-mycnf/ hints? What is the next step if I wish to make various changes such as timezone, etc?

cat /etc/os-release:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID_LIKE="rhel fedora"
PRETTY_NAME="CentOS Linux 7 (Core)"


PHP version: 7.1.14
cat /etc/yum.repos.d/MariaDB.repo (Gives information on how package was installed.):

# MariaDB 10.2 CentOS repository list - created 2017-07-17 12:45 UTC
# http://downloads.mariadb.org/mariadb/repositories/
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
ls -l /etc | grep sql (Nothing):

ls -l /etc | grep maria (Nothing):

ls -l /etc | grep my:

-rw-r--r--   1 root root      202 Feb 12 15:01 my.cnf
drwxr-xr-x   2 root root       78 Feb 19 12:05 my.cnf.d
cat /etc/my.cnf:

# This group is read both both by the client and the server
# use it for options that affect everything

# include all files from the config directory
!includedir /etc/my.cnf.d

ls -l /etc/my.cnf.d:

total 12
-rw-r--r-- 1 root root  763 Feb 12 15:01 enable_encryption.preset
-rw-r--r-- 1 root root  232 Feb 12 15:01 mysql-clients.cnf
-rw-r--r-- 1 root root 1080 Feb 12 15:01 server.cnf
tail -n +1 -- /etc/my.cnf.d/*:

==> /etc/my.cnf.d/enable_encryption.preset <==
# !include this file into your my.cnf (or any of *.cnf files in /etc/my.cnf.d)
# and it will enable data at rest encryption. This is a simple way to
# ensure that everything that can be encrypted will be and your
# data will not leak unencrypted.
# DO NOT EDIT THIS FILE! On MariaDB upgrades it might be replaced with a
# newer version and your edits will be lost. Instead, add your edits
# to the .cnf file after the !include directive.
# NOTE that you also need to install an encryption plugin for the encryption
# to work. See https://mariadb.com/kb/en/mariadb/data-at-rest-encryption/#encryption-key-management

==> /etc/my.cnf.d/mysql-clients.cnf <==
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility










==> /etc/my.cnf.d/server.cnf <==
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
# See the examples of server my.cnf files in /usr/share/mysql/

# this is read by the standalone daemon and embedded servers

# this is only for the mysqld standalone daemon

# * Galera-related settings
# Mandatory settings
# Allow server to accept connections on all interfaces.
# Optional setting

# this is only for embedded server

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand

ls -l /usr/share/mysql | grep cnf (Should I be swapping out /etc/my.cnf with one of these?):

-rw-r--r-- 1 root root   4920 Feb 12 16:58 my-huge.cnf
-rw-r--r-- 1 root root  20441 Feb 12 16:58 my-innodb-heavy-4G.cnf
-rw-r--r-- 1 root root   4907 Feb 12 16:58 my-large.cnf
-rw-r--r-- 1 root root   4920 Feb 12 16:58 my-medium.cnf
-rw-r--r-- 1 root root   2846 Feb 12 16:58 my-small.cnf
-rw-r--r-- 1 root root   3452 Feb 12 16:58 wsrep.cnf

EDIT. Ah, mysqld --help --verbose and mysqladmin variables is partially what I was looking for. But the question remains. Where are these default settings defined, and why can't I find any documentation/tutorial/blog recommending that they be modified?

mysqld  Ver 10.2.13-MariaDB for Linux on x86_64 (MariaDB Server)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Starts the MariaDB database server.

Usage: mysqld [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.2 mariadb mariadb-10.2 client-server galera
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file.


Variables (--variable-name=value)
and boolean options {FALSE|TRUE}                           Value (after reading options)
---------------------------------------------------------- ---------------
allow-suspicious-udfs                                      FALSE
aria                                                       ON
aria-block-size                                            8192

PS. The following was used to generate the above content and is provided for reference only.

function execute($cmd, $extra=null) {
    echo '<p>'.$cmd.($extra?'   ('.$extra.')':'').':</p><pre>'.shell_exec($cmd).'</pre>';

echo execute('cat /etc/os-release');
echo 'PHP version: ' . phpversion().'<br>';
echo execute('cat /etc/yum.repos.d/MariaDB.repo','Gives information on how package was installed.');
echo execute('ls -l /etc | grep sql','Nothing');
echo execute('ls -l /etc | grep maria','Nothing');
echo execute('ls -l /etc | grep my');
echo execute('cat /etc/my.cnf');
echo execute('ls -l /etc/my.cnf.d');
echo execute('tail -n +1 -- /etc/my.cnf.d/*');
echo execute('ls -l /usr/share/mysql | grep cnf','Should I be swapping out /etc/my.cnf with one of these?');

The my.cnf settings (including my.cnf.d/*), if any, are in front of built-in defaults. All of this is "reasonable" for a generic install.

Adding to them (or changing them) is important only after you find that your application is not 'average'.

The most important setting (for performance) is innodb_buffer_pool_size; it should be set to about 70% of available memory. Almost everything else (there are hundreds of "variables") does not need changing without a good reason.

True, this forum is loaded with questions relating to settings in my.cnf. I find that they fall into these categories:

  • "Bigger is better" -- users who get into trouble by increasing various settings without understanding the negative ramifications (such as running out of RAM).
  • "My site is slow; help me tune" -- The answer almost always involves INDEXes and/or query formulation, not tuning.
  • "I think ..." -- Many of the tunables are subtle, ambiguous, difficult to understand, etc. And it is rarely obvious how this tunable relates to that problem.

To get the full list (from, for example, the commandline tool "mysql"):


I gave you the one thing to change; don't worry about changing any others until you get specific advice.

  • Thanks Rick, As I showed in my original post, the only content in /etc/my.cnf is [client-server] !includedir /etc/my.cnf.d, and /etc/my.cnf.d only includes /etc/my.cnf.d/enable_encryption.preset (encryption related only), /etc/my.cnf.d/mysql-clients.cnf (no settings, but just tags), and /etc/my.cnf.d/server.cnf (no settings, but just tags). Is it really typical to have such sparsely populated configuration files? Mar 4 '18 at 13:08
  • Since all the defaults are reasonable (except the one I mentioned), an 'empty' config file should be OK. Older versions of MySQL/MariaDB had lots of settings and comments on why to change each one. It tended to overwhelm 'beginners' and sometimes invite the "bigger is better" syndrone.
    – Rick James
    Mar 4 '18 at 13:59
  • Thanks Rick, Was used to those giant config files and thought I was missing something. Mar 4 '18 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.