Skip to end of metadata
Go to start of metadata

Supported MySQL version is 5.6.4 and higher. MySQL in previous versions didn't support dates/timestamps with second fraction precision.
Release notes for MySQL 5.6.4
Release notes for ConnectorJ 5.1.23

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

Character sets and collation

MySQL 5.6 until version 8 has quite messy utf8 charset support. For MySQL 5.6 we can use utf8 charset (alias pointing to utf8mb3 - not full utf8) with collations like utf8_general_ci (case insensitive) or utf8_bin (case sensitive), but these collations will break order by - they compare only character code points, so upper case characters will be before lower case characters. From Mysql 8, mysql team recomends charset utf8mb4. Collation for correct searches would be utf8mb4_0900_as_cs. utf8mb4 is mainly necessary for deployments with extensive use of accented characters.

Having MariaDB and MySQL Drivers in the Same Classpath

Since MariaDB driver is bundled within midpoint.war and we want to use MySQL JDBC driver, we'll end up with two drivers that can handle jdbc:mysql://... To solve this issue we can follow MariaDB JDBC doc and use disableMariaDbDriver option. MariaDB driver will skip MySQL jdbc urls.

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

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 not bundled due to licencing issues. Download MySQL JDBC Driver and insert driver (for instance mysql-connector-java-5.1.30-bin.jar) on classpath either in deployed midpoint */webapps/midPoint/WEB-INF/lib or in */apache-tomcat/lib

Database create

Use proper sql script based on the distribution your 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.

Errata

  1. Release 2.1.1 contains bug which prevents correct repository loading with MySQL database with hibernateHbm2ddl configured to value "validate".
    Option 1: upgrade to 2.1.1p1 available here. This is preferred solution. Change "hibernateDialect" from org.hibernate.dialect.MySQL5InnoDBDialect to com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect
    Option 2: remove (comment out) line

    (should be line 61) from XML file which is in midpoint-2.1.1.war -> WEB-INF/lib/repo-sql-impl-2.1.1.jar -> ctx-repository-session.xml.
    Option 3: Change hibernateHbm2ddl in config.xml to "update" value, which means that Hibernate tries to update database schema if necessary, but that's not the best thing for production environment. We're using it only during development in automatic build system, so we don't need to update DB schema all the time.

Common issues

VARCHAR columns length

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 (see http://dev.mysql.com/doc/refman/5.5/en/innodb-restrictions.html).

There are two solutions for this situation:

  1. Update column definition and index definitions

    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
  2. Updating only column definitions and turning on innodb_large_prefix feature (Not tested with MidPoint)
    http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_large_prefix

Note that innodb_large_prefix is "ON" by default since MySQL 5.7.7 (and is deprecated as well), so this problem should not appear with the default settings of MySQL 5.7.7 and later. But make sure you have also set the correct innodb_file_format as well (please see here).

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 MySQL. To increase this value, see documentation for your MySQL version. In some cases this error is indicated as consequence for "No schema for resource" exception.

Sample my.cnf configuration file

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

  • No labels