I
I
IoakkunShoik2017-07-11 01:25:50
linux
IoakkunShoik, 2017-07-11 01:25:50

How to fix incorrect behavior of mongodb during authorization?

Hello! In general, the bottom line: for authorization in mongo, I use the
mongo -u root -p pswd command,
the problem is that after it, mongo asks for a password again and connects to the pswd database.
I also tried to add --authenticationDatabase "dbname" to this command, but nothing has changed, for some reason mongodb after the key, where the password should be, considers it as the name of the database to which the connection should go. Based on this, node js has the same problem, it is impossible to log in at all. How to fix it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
IoakkunShoik, 2017-07-12
@IoakkunShoik

helped reinstall the service and the correct start.
Firstly, we disable the mongodb service itself in /etc/init.d/ mongodb
and secondly, we use the command - mongod --auth
and of course, before that, the correct installation according to the recommendations in the official documentation.

S
Sergey Melnikov, 2017-07-11
@mlnkv

https://docs.mongodb.com/v3.2/tutorial/enable-auth...

C
Coder321, 2017-07-11
@Coder321

Where is your user created?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question