MariaDB

Last modified 01 Feb 2022 19:38 +01:00
Deprecated
This functionality is deprecated since version 4.4. The functionality is still supported and maintained, but it will no longer be extended. The plan is to remove this functionality sooner or later. Users of this functionality are strongly encouraged to stop using this functionality and migrate to a newer equivalent.

The setup for MariaDB is similar to MySQL in most aspects.

DO NOT FORGET TO RESTART TOMCAT AFTER CONFIGURATION CHANGE!!!

${midpoint-home}/config.xml repository configuration change

<configuration>
  <midpoint>
    <repository>
      <repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass>
      <database>mariadb</database>
      <jdbcUsername>midpoint</jdbcUsername>
      <jdbcPassword>password</jdbcPassword>
      <jdbcUrl>jdbc:mariadb://localhost:3306/midpoint?characterEncoding=utf8</jdbcUrl><!-- it seems that jdbc://mysql works as well -->
    </repository>
  </midpoint>
</configuration>

Please check also */apache-tomcat/bin/catalina.bat to point to correct midpoint home location (please set your own path):

set JAVA_OPTS=%JAVA_OPTS% -Dmidpoint.home=c:/midpoint_3_Node2 -XX:MaxPermSize=1024m

Driver

Driver is bundled in MidPoint.

Database create

CREATE DATABASE midpoint CHARACTER SET utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin DEFAULT COLLATE utf8_bin;
CREATE USER 'midpoint'@'localhost' IDENTIFIED BY 'password';
GRANT ALL on midpoint.* TO 'midpoint'@'localhost';
use midpoint;

Use proper sql script based on the distribution you are using either stable or snapshot:
For stable release check:
- the latest midpoint http://www.evolveum.com/downloads/midpoint/3.4/
- and download midpoint-3.4-dist.zip
- Execute MySQL database script located in: \midpoint-3.4-dist.zip\config\sql_all\mysql-3.4-all.sql
For snapshot check:
- the latest commit number on https://bamboo.evolveum.com/browse/MID-TRUNK/latestSuccessful
- and download it via http://athena.evolveum.com/builds/master/ where .zip file should be selected (midpoint-3.5-SNAPSHOT-dist.zip).
- Execute MySQL database script located in:
\midpoint-3.5-SNAPSHOT-dist.zip\config\sql_all\mysql-3.4-all.sql (or mysql-3.5-all, whatever will be present)

After starting tomcat in Windows via apache-tomcat\bin\startup.bat or Linux via apache-tomcat\bin\startup.sh open midpoint in browser http://localhost:8080/midpoint/admin/ Login:administrator Pass:5ecr3t and create new user. Check in MySQL table m_user where new user should be created: select * from m_user

Common issues

VARCHAR columns length (This section is copied from MySQL section)

As we’re using VARCHAR(255) for string columns there are situations when your object properties can exceed this limit. For example shadow name exceeds 255 characters (it’s possible for long DNs in LDAP or Active Directory). If you try to save such object you’ll get an error "Data truncation: Data too long for column 'name_orig' at row 1" and object is not saved to database.

If you try just to alter column to bigger size, you’ll end up with “#1071 - Specified key was too long; max key length is 767 bytes” error (if there is an index or unique constraint on that column). Reason for that is that by default VARCHAR(255) is maximum size for an indexes (also unique constraints) using utf8 and InnoDB storage.

There are two solutions for this situation:

  1. Update column definition and index definitions[WARNING] .Notice

This way you can store names with length up to 300 characters (in this sample code), but only first 255 chars from each value will be indexed. In case unique constraint index was used, uniqueness will be checked only against first 255 chars.

SQL
ALTER TABLE `m_shadow`
CHANGE COLUMN `name_norm` `name_norm` VARCHAR(300) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL,
CHANGE COLUMN `name_orig` `name_orig` VARCHAR(300) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL,

DROP INDEX `iShadowNameOrig`,
ADD INDEX `iShadowNameOrig` (`name_orig`(255) ASC),
DROP INDEX `iShadowNameNorm`,
ADD INDEX `iShadowNameNorm` (`name_norm`(255) ASC);
  1. Updating only column definitions and turning on innodb_large_prefix feature (Not tested with MidPoint)
    https://mariadb.com/kb/en/mariadb/xtradbinnodb-server-system-variables/#innodb_large_prefix

Note that innodb_large_prefix is "ON" by default since MariaDB 10.2.2 (and is deprecated as well), so this problem should not appear with the default settings of MariaDB 10.2.2 and later.

Packet for query is too large

When we’re using new LDAP Connector, usually generated resource schema in XML representation is bigger then default max_allowed_packet size in MariaDB. To increase this value, see documentation for your MariaDB version. In some cases this error is indicated as consequence for "No schema for resource" exception.

Sample my.cnf configuration file
[mysqld]
. . .
max_allowed_packet = 256M
. . .

You need to restart MariaDB after changing this configuration. Reload will not work.

Was this page helpful?
YES NO
Thanks for your feedback