> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rootprint.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Reset admin password

> Recover access to the Rootprint admin account by clearing the admin users and the first-admin setup flag, then completing the setup wizard again.

If you lose access to the admin account, remove every admin user from the database and clear the
first-admin setup flag, then let Rootprint guide you through creating a new admin via the setup
wizard.

<Note>
  Rootprint stores its state in **PostgreSQL**, not SQLite. The bundled Docker Compose file runs a
  `db` service (database `rootprint`, user `rootprint`). Adjust the commands below if you point
  `DATABASE_URL` at an external Postgres instance.
</Note>

<Warning>
  If you still have access to a second admin account, you do not need any of this. Sign in with that
  account and use **Settings → Users → Reset password** instead. It clears the locked-out user's
  password, signs them out, and gives you a fresh setup link to share so they can choose a new one.
</Warning>

## How the setup wizard is gated

The first-admin setup wizard at `/auth/setup-admin` is served only while the `first_admin_claimed`
row is **absent** from the `app_settings` table. Deleting your admin users alone is not enough. The
flag persists, so the wizard stays closed. You must remove both.

## Docker Compose (default install)

Run the two statements against the bundled `db` service. Deleting a `user` row cascades via foreign
keys to everything that user owns: sessions, linked accounts, API keys, saved views,
shares, and preferences.

```bash theme={"theme":"github-light"}
# 1. Remove every admin user.
docker compose exec db psql -U rootprint -d rootprint \
  -c "DELETE FROM \"user\" WHERE role = 'admin';"

# 2. Re-open the first-admin setup wizard.
docker compose exec db psql -U rootprint -d rootprint \
  -c "DELETE FROM app_settings WHERE key = 'first_admin_claimed';"
```

<Note>
  `user` is a reserved word in PostgreSQL, so it must be double-quoted (`"user"`).
</Note>

## External PostgreSQL

If `DATABASE_URL` points at a managed or external database, run the same two statements with any
`psql` client connected to that database:

```bash theme={"theme":"github-light"}
psql "$DATABASE_URL" -c "DELETE FROM \"user\" WHERE role = 'admin';"
psql "$DATABASE_URL" -c "DELETE FROM app_settings WHERE key = 'first_admin_claimed';"
```

## Finish in the UI

Open [http://localhost:8282](http://localhost:8282) in your browser. Because the setup flag is gone,
Rootprint redirects you to `/auth/setup-admin`. Enter your desired admin credentials and submit the
form.

<Note>
  The new admin account is active immediately. No restart is required. You can reuse the original
  admin email, since the old user row was deleted in step 1.
</Note>
