MariaDB: Configuration

  • The SQL_MODE can NOT have the value STRICT_TRANS_TABLE.
    Show enabled sql modes via mysql -uroot -p -e "SELECT @@GLOBAL.sql_mode;".
  • InnoDB must be available (deactivate --skip-innodb if necessary)

  • time_zone Must be available and configured (important for the time zones and the calendar).
    More information can be found under:
    Example for correct installation:
    $ mysql_tzinfo_to_sql /usr/share/zoneinfo | mariadb -uroot -p mysql
  • max-allowed-packet should be 256M (recommend 512M) including the newer COMPRESSED and DYNAMIC row formats.

  • The collation should be utf8mb4.

Create an additional config file for MariaDB in /etc/mysql/mariadb.conf.d/custom-mariadb.cnf which could look like this:

[client]
default-character-set   = utf8mb4

[mysqldump]
max_allowed_packet      = 256M

[server]

[mysqld]
default_storage_engine  = InnoDB
sql_mode                = "ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_allowed_packet      = 256M
character-set-server    = utf8mb4
collation-server        = utf8mb4_general_ci

After adding the configuration restart the MariaDB service by typing systemctl restart mariadb.service.