How to change password in mongodb
黄舟
黄舟 2017-05-17 10:01:43
0
2
687

How to change the password in mongodb? There are two methods mentioned on the Internet. I have not tried the first one,

I tried the second method:

db.changeUserPassword('tank2','test');

But it didn’t work. I used admin, and then executed it, and it reported User tank2@admin not found. I understand this, because my admin does not have this user. But after using dbname, and then authorizing the db.auth database, and then changing the password, it reported Error: Updating user failed: not authorized. This time it reported that I did not have permission.

Then I first use admin authorization, then switch back to my own database, and then change the password. It still reports User tank2@dbname not found. I can be sure that my database does have this user.
Otherwise, the execution modification command will never end, even if a semicolon is lost! .

So I really don’t understand.

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
小葫芦
db.addUser('tank2','123')

If the username is the same, it will be overwritten and the purpose of modification can also be achieved

大家讲道理

For operations related to MongoDB account management, you can refer to:
http://forum.foxera.com/mongo...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template