snippetMajor
How can I enter Mongo as a superuser or reset users?
Viewed 0 times
canmongoenterhowuserssuperuserreset
Problem
I'm was playing around with permissions and locked myself out of Mongo database. I'm pretty sure I did this by trying to explicitly add access to a database but instead I overwrote only allowing permission to the database. So I'm effectively locked out of my Mongo database and everything I read tells me how to create a super user if I have the add user privilege. Right now I don't think I have any users that have that privilege. Is there a way to enter the database as all access? I own the server and have root access.
Solution
If you have locked yourself out then you need to do the following:
- Stop your MongoDB instance
- Remove the --auth and/or --keyfile options from your MongoDB config to disable authentication
- Start the instance without authentication
- Edit the users as needed
- Restart the instance with authentication enabled
Context
StackExchange Database Administrators Q#62976, answer score: 45
Revisions (0)
No revisions yet.