Reputation: 363
I'm getting errors trying to run keycloak/quarkus with MySQL.
When I run the command to start the server :
> kc.bat start-dev
Keycloak connect to the database successfully, but it stops after giving this error :
2022-07-04 11:00:12,758 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler (main) ERROR: Failed to start server in (development) mode
2022-07-04 11:00:12,758 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to update database 2022-07-04 11:00:12,760 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: liquibase.exception.MigrationFailedException: Migration failed for change set META-INF/jpa-changelog-1.0.0.Final.xml::1.0.0.Final-KEYCLOAK-5461::[email protected]: Reason: liquibase.exception.DatabaseException: La clÚ est trop longue. Longueur maximale: 1000 [Failed SQL: (1071) ALTER TABLE keycloak_db_test.REALM_SOCIAL_CONFIG ADD PRIMARY KEY (REALM_ID, NAME)]
The error message : "The key is too long. Maximum length: 1000 [Failed SQL: (1071) ALTER TABLE keycloak_db_test.REALM_SOCIAL_CONFIG ADD PRIMARY KEY (REALM_ID, NAME)]"
I tried to this with Keycloak versions 18 & 17, and tried it with MySql 5 & MySQL 8 & MariaDB 10 I Also tried to enable innodb_large_prefix in my.ini, but still no go.
OS : Windows
The configuration file keycloak.conf:
db=mysql
db-username=root
db-password=
db-url-host=localhost
db-schema=keycloak_db_test
Any ideas that may help, please ?
Upvotes: 0
Views: 2729
Reputation: 363
After some digging and with the help of this answer, I found that the problem is related to the MySQL engine type.
The tables created by Keycloak are using MyISAM, and InnoDB is the one that supports large values, so the answer above indicate that I need to add NO_ENGINE_SUBSTITUTION
to sql-mode
values and comment skip-innodb
, but it didn't work until I changed the value of default-storage-engine
to innodb
.
Then the server started and successfully created the tables with InnoDB type.
Upvotes: 2