How can I change a user's Drupal password from the command line with Drush?
You can execute
drush uli, this will generate a one time login link.
By default it provides one-time login link for administrator.
If you execute
drush uli some-username, this will generate one time login link for that user.
You can also use
drush upwd for updating the password. Use it like this
drush upwd --password=<new password> <some-username>
$ drush help user-password (Re)Set the password for the user account with the specified name.
Examples: drush user-password someuser --password="correct horse battery" Set the password for the username someuser. @see xkcd.com/936
Arguments: name The name of the account to modify.
Options: --password= The new password for the account. Required.
There is another way to reset password. You can use
drush uli "username" which gives reset link in terminal, using the link you can login and change the password.
If you specify
-l http://localhost (where localhost is your host), then terminal would automatically open web browser for you.
Note that this command has changed in Drush 9.x, but can be found documented here
The syntax thus looks like this:
drush user:password someuser "correct horse battery staple"
For example, on the user 'bjenkins' it would be:
drush user:password bjenkins "newReallyComplexPassword123!"
You can also add a
--notify command to notify the user of this password change to their registered email.