Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak lost admin password

Tags:

keycloak

I have a local test installation of keycloak 12 and unfortunately I've lost the admin password, any idea on how to reset it or reset the keycloak configuration without losing the realms ?

I already used add-user cli command to add a user but even with that one I can't access

like image 985
pavants Avatar asked Feb 15 '26 06:02

pavants


1 Answers

For me, I had to find the user in the user_entity table. Then delete rows in related tables. After this, I restarted the pod, and the admin user login became the one passed through the environment variables KEYCLOAK_USER and KEYCLOAK_PASSWORD.

Find the user id

select * from user_entity

Delete rows

delete from credential where user_id = '<user-id>';
delete from user_role_mapping where user_id = '<user-id>';
delete from user_entity where id = '<user-id>';
like image 97
Frédéric Jacques Avatar answered Feb 21 '26 14:02

Frédéric Jacques



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!