Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Can't add user after creating admin user: createUser requires authentication

Anyone can help please
when I create admin user in mongo shell I got this problem
uncaught exception: Error: couldn’t add user: command createUser requires authentication :

You need to authenticate with the admin user to create subsequent users.

2 Likes

Hi @PT_Tadib_Sejahtera

If you are trying to create your first user when authentication is enabled you need to do it using mongo on the server that mongodb is running.

https://docs.mongodb.com/manual/core/security-users/#localhost-exception

Or you can follow the Enable Access Control Document.

2 Likes

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