From Gentoo Wiki
Jump to: navigation, search

MariaDB An enhanced, drop-in replacement for MySQL.

In Gentoo, dev-db/mariadb is the default package for items that depend on virtual/mysql.


USE flags

Cannot load package information. Is the atom dev-db/mariadb correct?


Install dev-db/mariadb:

root #emerge --ask mariadb


  • OpenRC:
To have the database(s) started automatically at boot, add it to the default runlevel:
root #rc-update add mysql default
If the database is configured, start the service:
root #rc-service mysql start
  • Systemd:
  • With MariaDB < 10.1
root #systemctl enable mysqld.service
  • With MariaDB >= 10.1.8
As of MariaDB 10.1.8, it includes a notify based unit to use instead of a script to check if the system is alive.
root #systemctl enable mariadb.service


Preliminary configuration

Gentoo MariaDB package maintainers will help you set up MariaDB through the configuration option in the ebuild.

root #emerge --config dev-db/mariadb

The configuration will create a database, set proper permissions, and assist you in creating a secure root password (this is for the MariaDB root account, which is not related to the Linux root account).

In-database configuration

When the database is set up and running, connect to MariaDB using the mysql client application.

user $mysql -u root -p -h localhost
Enter root password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 86415
Server version: 5.5.32-MariaDB-log Source distribution

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Custom options

Beginning with MariaDB 10.2, the configuration file my.cnf, includes a single directive to include /etc/mysql/mariadb.d and all files located within. Gentoo includes a file for server settings and one for client settings. Create your own files in this directory and they will be added together in alphabetical order. The base configuration accepts almost all the defaults and only tweaks paths. Tune your server to your liking.


Compiling against

Beginning with MariaDB 10.2, a new LGPL client library is included.

With MariaDB 10.2.8, the server and client headers were separated. This causes compilation errors in some programs which previously relied on server features.


One example is MYSQL_SERVER_VERSION. A quick fix can be:


Ultimately, MYSQL_SERVER_VERSION should be removed and use the MYSQL_VERSION_ID integer for version identification.

See also

External resources