- Reference >
mongo
Shell Methods >- Database Methods >
- db.changeUserPassword()
db.changeUserPassword()¶
On this page
Definition¶
-
db.
changeUserPassword
(username, password)¶ Allows an administrator to update a user’s password from within the shell.
Parameter Type Description username
string Specifies an existing username with access privileges for this database. password
string Specifies the corresponding password. Throws: exception – If an error occurs, the db.changeUserPassword()
helper throws an exception with the error message and code.
Example¶
Example
The following operation changes the reporting
user’s
password to SOhSS3TbYhxusooLiW8ypJPxmt1oOfL
: