Change admin password in keycloak 19

Hi,

in keycloak 18 I could reset the admin password with deleting the admin user from database and then set the 2 variables KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD and the start up the keycloak server with ‘kc.sh start’. I don’t get this to work in keycloak 19. Is there any other way to set the admin password from commandline ?.

Kind Regards
Joakim

You can do it that way if you truncate your USER_ENTITY table and dependent tables. That will of course remove all user accounts in Keycloak. The reason this helps is that there’s a check in the setup code that won’t create the admin account if any user account exists.

If you’re using postgres, it’s as simple as running this somewhat destructive query:

TRUNCATE USER_ENTITY CASCADE;