Keycloak 17 Quarkus is not using db-schema parameter properly
See original GitHub issueDescribe the bug
I am trying to deploy Keycloak 17 Quarkus with MariaDb and schema name different from default ‘keycloak’.
I created database with name ‘db4keycloak’ and trying to start Keycloak.
bin/kc.sh start-dev \
--db mariadb \
--db-url-host localhost \
--db-username keycloak \
--db-password mypwd \
--db-schema db4keycloak
And getting error:
022-03-03 21:17:17,040 WARN [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=45) Unknown database 'keycloak'
Keycloak is still trying to connect to default database ‘keycloak’ in JdbcEnvironmentInitiator.
Version
17.0.0
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
- Install MariaDb
- Create database user ‘keycloak’ and database ‘db4keycloak’
create database db4keycloak;
GRANT ALL PRIVILEGES ON db4keycloak.* to keycloak@'%' IDENTIFIED BY 'mypwd';
GRANT ALL PRIVILEGES ON db4keycloak.* to keycloak@'localhost' IDENTIFIED BY 'mypwd';
flush privileges;
- Start Keycloak:
bin/kc.sh start-dev \
--db mariadb \
--db-url-host localhost \
--db-username keycloak \
--db-password mypwd \
--db-schema db4keycloak
You will see error message:
[org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLSyntaxErrorException: Could not connect to address=(host=localhost)(port=3306)(type=master) : (conn=50) Unknown database 'keycloak'
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Keycloak 17.0.0 released
A new approach to documentation in form of server guides to help you install and configure Keycloak. Upgraded Quarkus to 2.7.0.Final.
Read more >All configuration options - Quarkus
AWS Lambda Type Default
AWS Lambda Common Type Default
AWS Lambda Gateway REST API Type Default
Agroal ‑ Database connection pool Type Default
Read more >Can't run keycloak 17 on Quarkus with cross DC mode #10521
My next step was to run keycloak in another DC with different network. I tried to put jgroups configuration at the beginning cache.xml....
Read more >unable to start keycloak server duo to mysql error - Stack ...
I'm getting errors trying to run keycloak/quarkus with MySQL. I tried to this with Keycloak versions 18 & 17, and tried it with...
Read more >Keycloak Puppet module
If you use the SSSD user provider and SSSD related parameters, ... Define a Keycloak realm that uses username and not email for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would wait util the merge request is accepted / merged and then close it.
to wrap up from what I understood
--db-url-database
should be used as mysql/mariadb doesn’t have theschema
concept and this issue and PR could be closed then. Feel free to re-open when I miss something 😃note to future me: when we have the ability to show config based on a rule engine (“dependant”), we should remove the db-schema option at runtime when database == mariadb/mysql at buildtime.