facebook youtube pinterest twitter reddit whatsapp instagram

Changing the MariaDb Configuration Files

You can tune MariaDB to your liken using the MariaDB’s option files.

The default MariaDB option file is called my.cnf on Unix-like operating systems (i.e Ubuntu, Debian, and the likes), if you are used to MySQL, then this shouldn’t be new to you, the config file can be used to change a lot, e.g the buffer sizes, the max_upload size, and more.

The config files are located in the /etc/mysql, change to the directory by executing cd /etc/mysql

This would list the following files:

drwxr-xr-x  2 root root 4096 Jun 24 10:50 conf.d
-rw-------  1 root root  277 Jun 24 10:50 debian.cnf
-rwxr-xr-x  1 root root 1509 Jan 30 07:25 debian-start
-rw-r--r--  1 root root  869 Jan 30 07:25 mariadb.cnf
drwxr-xr-x  2 root root 4096 Jun 24 10:50 mariadb.conf.d
lrwxrwxrwx  1 root root   24 Jun 24 10:50 my.cnf -> /etc/alternatives/my.cnf
-rw-r--r--  1 root root  839 Aug  3  2016 my.cnf.fallback

To configure MariaDB to run the way you want, you may consider creating a new configuration file with the .cnf extension, although this isn’t a requirement, to actually get started you might want to understand how MariaDB reads the config file, this instruction is located in the mariadb.conf The MariaDB tools read configuration files in the following order:

  • "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
  • "/etc/mysql/conf.d/*.cnf" to set global options.
  • "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
  • "~/.my.cnf" to set user-specific options.

Note: If the same option is defined multiple times, the last one will apply.

If you want to adjust or tune the config of your MariaDB, simply edit it in the conf.d directory, e.g

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf