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.
Prerequisites
- 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
Stop the n8n service before resetting
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.
1# Systemd2sudo systemctl stop n8n34# Docker5docker stop n8n67# PM28pm2 stop n8n910# Direct process — press Ctrl+C in the terminalExpected result: The n8n service is stopped and no n8n processes are running.
Run the user-management:reset command
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.
1# Bare metal / npm install2n8n user-management:reset34# Docker (container named 'n8n')5docker exec -it n8n n8n user-management:reset67# Docker Compose8docker compose exec n8n n8n user-management:reset910# If n8n is installed globally with a custom data path11N8N_USER_FOLDER=/path/to/.n8n n8n user-management:resetExpected result: The terminal shows a success message confirming that user management has been reset.
Start n8n and create a new admin account
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.
1# Systemd2sudo systemctl start n8n34# Docker5docker start n8n67# PM28pm2 start n8n910# Direct11n8n startExpected result: The n8n setup wizard appears, and you can create a new admin account with access to all existing workflows and credentials.
Verify the new admin credentials work
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 working example
1#!/bin/bash2# Reset n8n admin credentials3# Works for systemd, Docker, and pm2 deployments45set -e67echo "=== n8n Admin Credential Reset ==="8echo "WARNING: This will remove ALL user accounts."9echo "Workflows and credentials are NOT affected."10read -p "Continue? (y/N): " confirm1112if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then13 echo "Aborted."14 exit 015fi1617# Detect deployment method18if systemctl is-active --quiet n8n 2>/dev/null; then19 echo "Detected: systemd"20 sudo systemctl stop n8n21 n8n user-management:reset22 sudo systemctl start n8n23 echo "Reset complete. Open n8n in your browser to create a new admin."2425elif docker ps --format '{{.Names}}' | grep -q '^n8n$'; then26 echo "Detected: Docker"27 docker stop n8n28 docker run --rm \29 --volumes-from n8n \30 --env-file <(docker inspect n8n --format '{{range .Config.Env}}{{println .}}{{end}}') \31 n8nio/n8n n8n user-management:reset32 docker start n8n33 echo "Reset complete. Open n8n in your browser to create a new admin."3435elif pm2 list 2>/dev/null | grep -q 'n8n'; then36 echo "Detected: PM2"37 pm2 stop n8n38 n8n user-management:reset39 pm2 start n8n40 echo "Reset complete. Open n8n in your browser to create a new admin."4142else43 echo "No running n8n instance detected."44 echo "Running reset command directly..."45 n8n user-management:reset46 echo "Reset complete. Start n8n and open it in your browser."47fiCommon mistakes when resetting Admin Credentials in n8n
Why it's a problem: Running the reset command while n8n is still running, causing database lock errors
How to avoid: Stop n8n completely before running n8n user-management:reset. Verify with ps aux | grep n8n.
Why it's a problem: Thinking the reset command deletes workflows and credentials
How to avoid: The command only removes user accounts. All workflows, credentials, and execution history remain intact.
Why it's a problem: Running the command without the correct database connection environment variables
How to avoid: If n8n uses PostgreSQL, set DB_TYPE, DB_POSTGRESDB_HOST, and other connection variables before running the command.
Why it's a problem: Trying to reset credentials on n8n Cloud
How to avoid: 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
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I forgot my n8n admin password and cannot log into my self-hosted instance. How do I reset it without losing my workflows? I am running n8n in Docker.
Reset my admin password by running n8n user-management:reset inside my Docker container named n8n, then restart the container so I can create a new admin account.
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.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation