# How to Reset Admin Credentials in n8n

- Tool: n8n
- Difficulty: Beginner
- Time required: 5 minutes
- Compatibility: n8n 1.0+ (self-hosted only)
- Last updated: March 2026

## TL;DR

To reset admin credentials in n8n, run the CLI command n8n user-management:reset which removes all user accounts and allows you to set up a new admin account from scratch. For Docker deployments, run this command inside the container. This is the only supported method — there is no password reset email or UI option.

## Resetting Your n8n Admin Password When Locked Out

If you forget your n8n admin password, the only way to regain access is through the CLI command n8n user-management:reset. This command removes all existing user accounts and resets n8n to its initial setup state, where you can create a new admin account. This tutorial covers how to run the command for different deployment methods: bare metal, Docker, and systemd.

## Before you start

- Terminal or SSH access to the server running n8n
- Permission to run commands as the n8n user or root
- n8n installed via npm, Docker, or system package

## Step-by-step guide

### 1. Stop the n8n service before resetting

Before running the reset command, stop the n8n service to avoid conflicts with the database. How you stop n8n depends on how you installed it. For systemd, use systemctl stop n8n. For Docker, use docker stop n8n. For pm2, use pm2 stop n8n. If you are running n8n directly in a terminal, press Ctrl+C to stop it. The reset command needs exclusive access to the database, so make sure no other n8n process is running.

```
# Systemd
sudo systemctl stop n8n

# Docker
docker stop n8n

# PM2
pm2 stop n8n

# Direct process — press Ctrl+C in the terminal
```

**Expected result:** The n8n service is stopped and no n8n processes are running.

### 2. Run the user-management:reset command

Execute the n8n user-management:reset command. This removes all user accounts from the n8n database, including the admin account and any additional users you created. It does NOT delete workflows, credentials, or execution history — only user accounts. After the reset, n8n will behave as if it was freshly installed, showing the account setup screen on next launch.

```
# Bare metal / npm install
n8n user-management:reset

# Docker (container named 'n8n')
docker exec -it n8n n8n user-management:reset

# Docker Compose
docker compose exec n8n n8n user-management:reset

# If n8n is installed globally with a custom data path
N8N_USER_FOLDER=/path/to/.n8n n8n user-management:reset
```

**Expected result:** The terminal shows a success message confirming that user management has been reset.

### 3. Start n8n and create a new admin account

Start n8n again using the same method you normally use. Open the n8n UI in your browser. Instead of the login screen, you will see the initial setup wizard that asks you to create a new owner account. Enter your name, email, and a new password. This new account becomes the admin with full access to all workflows, credentials, and settings. Any workflows and credentials from before the reset are still there — only the user accounts were removed.

```
# Systemd
sudo systemctl start n8n

# Docker
docker start n8n

# PM2
pm2 start n8n

# Direct
n8n start
```

**Expected result:** The n8n setup wizard appears, and you can create a new admin account with access to all existing workflows and credentials.

### 4. Verify the new admin credentials work

Open your browser and navigate to your n8n instance URL (typically http://localhost:5678). You should see the login screen. Enter the new email address and password you just set. If the login succeeds, your admin credentials have been reset successfully. Check that you can access all workflows and settings as the admin user. If you had other users configured, verify they can still log in with their own credentials as well.

**Expected result:** You can log in with the new admin credentials and access the full n8n dashboard with all workflows visible.

## Complete code example

File: `reset-admin.sh`

```bash
#!/bin/bash
# Reset n8n admin credentials
# Works for systemd, Docker, and pm2 deployments

set -e

echo "=== n8n Admin Credential Reset ==="
echo "WARNING: This will remove ALL user accounts."
echo "Workflows and credentials are NOT affected."
read -p "Continue? (y/N): " confirm

if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
  echo "Aborted."
  exit 0
fi

# Detect deployment method
if systemctl is-active --quiet n8n 2>/dev/null; then
  echo "Detected: systemd"
  sudo systemctl stop n8n
  n8n user-management:reset
  sudo systemctl start n8n
  echo "Reset complete. Open n8n in your browser to create a new admin."

elif docker ps --format '{{.Names}}' | grep -q '^n8n$'; then
  echo "Detected: Docker"
  docker stop n8n
  docker run --rm \
    --volumes-from n8n \
    --env-file <(docker inspect n8n --format '{{range .Config.Env}}{{println .}}{{end}}') \
    n8nio/n8n n8n user-management:reset
  docker start n8n
  echo "Reset complete. Open n8n in your browser to create a new admin."

elif pm2 list 2>/dev/null | grep -q 'n8n'; then
  echo "Detected: PM2"
  pm2 stop n8n
  n8n user-management:reset
  pm2 start n8n
  echo "Reset complete. Open n8n in your browser to create a new admin."

else
  echo "No running n8n instance detected."
  echo "Running reset command directly..."
  n8n user-management:reset
  echo "Reset complete. Start n8n and open it in your browser."
fi
```

## Common mistakes

- **Running the reset command while n8n is still running, causing database lock errors** — undefined Fix: Stop n8n completely before running n8n user-management:reset. Verify with ps aux | grep n8n.
- **Thinking the reset command deletes workflows and credentials** — undefined Fix: The command only removes user accounts. All workflows, credentials, and execution history remain intact.
- **Running the command without the correct database connection environment variables** — undefined Fix: If n8n uses PostgreSQL, set DB_TYPE, DB_POSTGRESDB_HOST, and other connection variables before running the command.
- **Trying to reset credentials on n8n Cloud** — undefined Fix: The CLI reset command is for self-hosted only. On n8n Cloud, use the forgot password link on the login page or contact n8n support.

## Best practices

- Store your n8n admin password in a password manager to avoid needing resets
- Back up your n8n database before running the reset command, even though it only removes user accounts
- Use strong, unique passwords for the n8n admin account
- Set up multiple admin users so that one can reset another's password from the UI
- If running n8n in Docker, document the exact docker exec command in your runbook
- Consider enabling LDAP or SAML authentication on Enterprise plans to avoid local password management

## Frequently asked questions

### Does n8n user-management:reset delete my workflows?

No. The command only removes user accounts. All workflows, credentials, execution history, and settings remain exactly as they were. You just need to create a new admin account to access them.

### Can I reset just my password without removing all users?

No. The user-management:reset command is all-or-nothing — it removes all user accounts. If you have multiple users, they will all need to be re-invited after the reset. Another admin user can change your password from the Users settings page without a reset.

### Is there a forgot password option for self-hosted n8n?

Self-hosted n8n does not have a forgot password email flow by default. The only way to reset a forgotten admin password is the CLI command. If you configured SMTP settings, invited users receive password setup emails, but there is no recovery flow.

### How do I run the reset command if n8n is in a Docker container?

Use docker exec -it n8n n8n user-management:reset where n8n is your container name. If the container is stopped, use docker run with the same volumes and environment variables to run the command.

### What if the reset command gives a database connection error?

The command needs the same database configuration as your running n8n instance. Set DB_TYPE, DB_POSTGRESDB_HOST, and other connection variables as environment variables before running the command, or ensure they are in the .env file.

### Can RapidDev help me recover access to a locked n8n instance?

Yes, RapidDev can assist with admin credential resets, database recovery, and setting up proper user management with multiple admin accounts to prevent future lockouts.

---

Source: https://www.rapidevelopers.com/n8n-tutorial/how-to-reset-admin-credentials-in-n8n
© RapidDev — https://www.rapidevelopers.com/n8n-tutorial/how-to-reset-admin-credentials-in-n8n
