Skip to content

Holds Keycloak's realms, clients, roles, and sessions. Losing it means reconfiguring every realm and client by hand, so it is one of the databases most worth backing up.

Create

Connect as a superuser on the host running PostgreSQL:

psql -h <DATABASE_HOST> -U postgres
-- as a superuser
create user keycloak with password '<GENERATED_SECRET>';
create database keycloak with owner keycloak;

Migrations

Keycloak applies its own schema migrations at startup, so there is nothing to run here. The first start after a Keycloak version upgrade takes noticeably longer for that reason.

No extensions are required.

Related