3

After droping mongodb user ,not able to reconnect mongo again without authentication

i had created superuser tomuser

my command sequence in ubuntu terminal

1.use admin

2.db.dropUser('tomuser') true exit

3.sudo /etc/init.d/mongod stop

4.sudo /etc/init.d/mongod start

5.restart pc

6.mongo --port 27017

7.> show dbs 2016-01-14T16:03:55.420+0530 listDatabases failed:{ "ok" : 0, "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }", "code" : 13 } at src/mongo/shell/mongo.js:47


I am getting above error!! not authorized on admin to execute command

so ,not able to connect mongodb after dropping user ..?

is there any thing missing ...?

2
  • OK.. What is your question? Commented Jan 14, 2016 at 10:48
  • @MHakvoort i have edit question :) Commented Jan 14, 2016 at 11:00

1 Answer 1

4

1st way

I think there should be another user in the db.system.users. If so, please use the saved user to log in.

If there is NO users in the db.system.users

> db.system.users.find({})
  null

we can access mongodb through mongo --port 27017.

2nd way - Usual cause of problem

use sudo mongod --port 27017

instead of sudo mongod --auth --port 27017 --dbpath /var/lib/mongodb

note : --auth is only required when username & password authentication is setup

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.