HELP! Forgot password then deleted the user, cant login nor send smtp email

Describe the problem/error/question

I forgot my password and then foolishly following the guide here “Password recovery - #2 by Jon” deleted the user. now i cant send smtp email (i tried that first using mailersend) nor the setup screen shows up. I am hosting it on railway so cant access the container to run “n8n user-management:reset” either. the pgsql container’s role and user tables are clear. This is the sql command I ran:
delete from “user”;
delete from “role”;
update settings SET value = ‘false’ WHERE key = ‘userManagement.isInstanceOwnerSetUp’;

I can access the pgsql but only using another dummy n8n container i have there. @Jon I would really appreciate if you have any idea.

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Ahmad_Rajput

Have you tried to use the railway CLI?
The command n8n user-management:reset is the only official way to reset the password.

It simply says ‘n8n’ is not recognized as an internal or external command,
operable program or batch file. I tried a bunch of way but never got this railway cli to work with others too. btw i didnt setup a local project for it.

is it possible i can create the user itself in db?

I changed the start command of container to n8n user-management:reset but it gave back error in logs:
Error resetting database. See log messages for details.

Could not find any entity of type “Project” matching: {

“where”: {

“type”: “personal”,

“projectRelations”: {
“userId”: “5c03dffd-7aa5-41bf-a55a-bd0dc5862ff3”,

“role”: “project:personalOwner”

}

}

}

If you can help me in this regard or point me in a way i might find some help, then it would be very appreciated!

The issue was resolved by creating the user directly in db and recreating roles. Furthermore, the relations between user and projects was also recreated with right permissions.

Lesson learned: Never mess with existing application db again and take all advices with a boulder of salt.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.