Admin User in Instance Cannot Execute Any Commands

Hello, I have a mongo instance where there is only one user, which is admin. I am unable to run any commands such as db.getUsers() or even anything. I am trying to make the user root, so that it would be able to run any command but I am unable to. I am stuck with one user that cannot run any commands, and am unsure what to do next:

MongoServerError: not authorized on admin to execute command

any advice on this would be greatly appreciated

How did you connect to your instance
Did you authenticate against Authorization database?
Does other commands work like
Db
Sho dbs
Show users etc

Hi @Edward_Lee2,
Are you sure this user had the admin privileges?
It was created in the admin database?
I suggest you to create a new user in the admin database by following this steps:

  • disable authentication
  • create admin user in the admin db
  • enable authentication

BR

1 Like