How to extend the MariaDB config file, includedir - include
Last updated: May 21, 2022
In today's article, I will tell you how to include additional parameter files from another parameter file in MariaDB. There are situations when you will not have root privileges, and the database configuration file itself is located along the path /etc/my.cnf.d/server.cnf, but you will not have access to it, since the server administrator will take root after installing the database .
- Stop the MariaDB database.
- Let's edit the configuration file.
- We start the database.
1. Stop the MariaDB database.
Before we get started, let's stop the database.
$. service mariadb stop
2. Let's edit the configuration file.
The database configuration file is located at /etc/my.cnf.d/server.cnf
$. vim /etc/my.cnf.d/server.cnf
We have two options on how to extend the configuration.
The first is to add the !include /mariadb/config/config-file.cnf option to /etc/my.cnf.d/server.cnf.
Thus, we indicate to the database server that our configuration will continue in the config-file.cnf file, which is located along the path that we indicated above. The file name can be arbitrary. The main thing is that the owner of the file should be mysql. Save the file and start the database.
The second option is to add the parameter !includedir /mariadb/config/ to /etc/my.cnf.d/server.cnf
With this configuration extension option, we indicate to the database server that we will have the configuration expand along the /mariadb/config/ path. The file name can be arbitrary. The main thing is that the owner of the directory should be mysql. Save the file and start the database.
3. We start the database.
$. service mariadb start
All that we have done is for our convenience, and whether you use it in your projects is up to you. But I would recommend doing it because you can break the configuration into categories, the first file is responsible for client connections, the second for backup, the third for replication, the fourth for the database.