Accessing the Keycloak H2 database

When running Keycloak out-of-the box it will use a H2 database. This is built-in and no extra configuration is needed. It is possible (and recommended in production) to use another database. Options are MySQL, PostgreSQL, etc. For development the H2 database is fine.

When you use an external database you can access the database with you favorite database explorer software, HeidiSQL, DBBeaver, pgAdmin. But when you still use the H2 database you maybe want to access this database.

To explorer your H2 database open you terminal and go to the Keycloak directory.

java -cp ./modules/system/layers/base/com/h2database/h2/main/h2-*.jar -url "jdbc:h2:./standalone/data/keycloak;AUTO_SERVER=TRUE" -user sa -password sa

Your browser will start and the H2 console will open.

16-06-2021 EN keycloak h2 database
Deel via: LinkedIn Twitter