How to Configure MariaDB on Ubuntu 20.04

Step 1 : The configuration files for MariaDB are stored in the /etc/mysql directory. In that directory, you’ll see the following files by default:

ls /etc/mysql

Step 2 : The configuration file that MariadDB reads on startup is the /etc/mysql/mariadb.cnf file. The /etc/mysql/mariadb.cnf file sets the global defaults for MariaDB. However, in Ubuntu’s implementation, this default file just includes configuration files from the /etc/mysql/conf.d and the /etc/mysql/mariadb.conf.d directories.

cat /etc/mysql/mariadb.cnf

Step 3 : Within those directories, there are additional files ending with the .cnf extension. Many of these files contain default configuration values that would normally be found in a single file, but Ubuntu’s implementation modularizes these settings into separate files instead.

ls /etc/mysql/conf.d/
ls /etc/mysql/mariadb.conf.d/

Step 4 : For additional information on how these configuration files are read, you can refer to the /etc/mysql/mariadb.cnf file, which includes some helpful contents at the top of the file that details the order in which these configuration files are read, as well as their purpose.

# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.

Add Comment