0

I'm trying to start up a Spring Boot server containing an embedded Keycloak authorization server, following this tutorial. Tutorial's code is here. My own adaptation is a MySQL DB, instead of H2, fired up via docker-compose

On server start-up, I get this error while DB patches are being applied: Caused by: java.sql.SQLSyntaxErrorException: Table 'auth.client_session' doesn't exist. SequelPro threw same error, but the table is visually there. I solved this by looking around this thread. (a restart was sufficient for me)

Next error was from the next patch, quoting: keycloak java.sql.SQLSyntaxErrorException: Table 'client_attributes' already exists, and with this one I'm stuck in DB migration limbo, because if I deleted it, it's going to circle back to a "does not exist" error.

Versions:

  • Spring Boot 2.2.4.RELEASE
  • MySQL 5.7.32
  • org.keycloak:keycloak-dependencies-server-all:10.0.1
Georgian
  • 8,795
  • 8
  • 46
  • 87

1 Answers1

2

Changing MySQL's lower_case_table_names config to 1 solves this issue. Inspired by this answer.

To burn this setting via docker-compose, customise your command in the yaml file (inspired by this repo):

db-service:
  [...]
  ports:
    - 3306:3306
  command: mysqld --lower_case_table_names=1 

Also make sure the table's encoding is UTF-8, to avoid another head scratching error: keycloak Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535

Other references:

Georgian
  • 8,795
  • 8
  • 46
  • 87