MariaDB / MySQL

MariaDB is the successor to MySQL after Oracle went a bit crazy on it. MariaDB is more updated, more secure and generally the logical successor to MySQL. And it's 100% compatible.

Installing MariaDB is easy:

emerge mariadb


The Gentoo guide says it all, but i want to ensure that the database is actually stored on the RAID array and not on the Gentoo root folder.

This is configured in /etc/mysql/mariadb.d/50-distro-server.cnf, find and change the following line:

datadir                                         = /data/mysql

move the folder to somewhere under /data/.

After editing this file, run the first time configuration, so before starting it, run:

emerge --config dev-db/mariadb

Input and remember your root password!


Start the service and set it on boot:

rc-update add mysql default
/etc/init.d/mysql start


It's a good idea to create a separated database and user for each service you are oging to use with MariaDB. These instructions are not exaustive but only a quick reference:

Login to the MariaDB

mysql -u root -p -h localhost

Creating a database with user

create database DATABASE_NAME;
grant all privileges on DATABASE_NAME.* TO 'USER_NAME'@'localhost' identified by 'PASSWORD';
flush privileges;