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.
高洛峰2017-05-17 10:03:43
db.addUser('tank2','123')
If the username is the same, it will be overwritten and the purpose of modification can also be achieved
大家讲道理2017-05-17 10:03:43
For operations related to MongoDB account management, you can refer to:
http://forum.foxera.com/mongo...