mysqld Configuration Files and Groups

You are viewing an old version of this article. View the current version here.

Default options are generally read from the following files in the given order:

  1. /etc/my.cnf
  2. /etc/mysql/my.cnf
  3. my.cnf in the DEFAULT_SYSCONFDIR specified during the compilation
  4. my.cnf in the path, specified in the environment variable MYSQL_HOME (if any)
  5. the file specified in --defaults-extra-file (if any)
  6. user-home-dir/.my.cnf

For an exact list for your system execute mysqld --help --verbose. The full file list will be near the beginning of the output.

This page lists the different mysqld startup options you can use.

mysqld reads the following my.cnf sections:

  1. [mysqld]
  2. [server]
  3. [mysqld-X.X]
  4. [mariadb]
  5. [mariadb-X.X]
  6. [client-server] -- (MariaDB 5.3 and higher)
  7. [galera] -- (MariaDB 10.1 and higher or MariaDB galera builds)

X.X in the examples above refer to the base (major.minor) version of the server. For example in MariaDB 5.5.32 the base version is 5.5. mysqld --help --verbose will show which sections are read in the top part of its output.

For a full list of mysqld options and their current values (based on your local my.cnf), do:

mysqld --print-defaults
mysqld --help --verbose

Global Options

The following options determine how mysqld handles option files. They must be given as the first argument:

OptionDescription
--print-defaultsPrint the program argument list and exit.
--no-defaultsDon't read default options from any option file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

MariaDB Options

The full sets of options are described here.

Minimal my.cnf file

Here is a minimal my.cnf file you can install in ~/.my.cnf to test MariaDB 5.3. (For 5.2, you need to copy the section [client-server] to [client] and [mysqld]).

[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
# Create a file where the InnoDB/XtraDB engine stores it's data
loose-innodb_data_file_path = ibdata1:1000M
loose-innodb_file_per_table

# 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

The following my.cnf example files are included with MariaDB. Examine them to see more complete examples of some of the many ways to configure MariaDB.

  • my-small.cnf
  • my-medium.cnf
  • my-large.cnf
  • my-huge.cnf

The above example files can usually be found in one of the following directories:

  • source-file-path/support-files
  • mysql-install-path/share/mysql (e.g. /usr/local/mysql/share/mysql)

See also

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.