Keycloak and InnoDB Cluster

It seems many people have had issues setting up Keycloak with InnoDB Cluster (Group Replication).

Unfortunately the error messages thrown by the set process (Java) haven’t been very helpful in pointing out the actual reason behind the failures. Finding the root cause in such a scenario isn’t straightforward.

Searching on the web, I couldn’t find an answer but I eventually found the reason for the failures and a solution.

Root cause:

  • InnoDB Cluster uses Group replication to enable creating elastic, highly-available, fault-tolerant replication topologies.
  • Group replication requires that every table in MySQL database has a primary key
  • Keycloak uses Liquibase for managing database migrations via a table called DATABASECHANGELOG. This table doesn’t have a primary key defined and so InnoDB Cluster logs this in MySQL error log and fails. Keycloak initialisation process then terminates with an error.


  • Before installing Keycloak, create the DATABASECHANGELOG table manually and add a primary key
  • Now install keycloak as normal

Hope this helps.