How can I change a user's password from the command line using Drush?


11 Answers 11


In Drush 9, the command is drush user:password USERNAME "SOMEPASSWORD"; its aliases are user-password and upwd.

In Drush 8 (and earlier) the command is drush user-password USERNAME --password="SOMEPASSWORD"; its alias is upwd.

  • 4
    Man Tim, you got in like a couple seconds after me. :)
    – Dave Reid
    Mar 2, 2011 at 21:03
  • You can find more information about "Recovering the administrator password" here: drupal.org/node/44164
    – milkovsky
    Feb 26, 2015 at 13:53
  • Instead of username, you could also use the user id: drush upwd 1 --password="newpassword" for user 1
    – FLY
    Jan 31, 2017 at 13:26
  • For Drush 9 (Latest D8) see this answer
    – No Sssweat
    Dec 1, 2018 at 12:47
  • 1
    Answer updated with Drush 9 info. (Editing a good existing answer is a nice feature.)
    – hansfn
    Feb 5, 2019 at 17:03

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>

  • 2
    Worth noting that drush uli should be the preferred route in general from a good security practice POV because it means you do not have to communicate the password, the user can choose their own. Jul 20, 2018 at 8:33

If you are using Drush 4, you can use the user-password command.

drush user-password usernamehere --password="newpasswordhere"

$ 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.

Aliases: upwd


In Drush 9 (recommended for > Drupal 8.4) this is slightly different:

  • 1
    Just a note: The new password here would be "password=MYPASSWORD" not MYPASSWORD Jun 26, 2018 at 22:56
  • The comment from Will seems wrong. Anyway, the top voted answer is updated with info for Drush 9.
    – hansfn
    Feb 5, 2019 at 22:46
  • It wasn't before the edit Mar 14, 2019 at 22:14

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.

  • 1
    This works, but you may need Drupal 7.50 (released 2016-07-07) to not run into issue 889772 ("needing password to change password").
    – tanius
    Jul 11, 2016 at 12:42

in New version of Drush(In Drush 9 Drupal > 8.5 ) it doesn't work with

drush user-password USERNAME --password="SOMEPASSWORD"

It must be

drush user-password USERNAME SOMEPASSWORD

for example ( change password of root user)

drush user-password root MyPass0302

And with Drupal Console

drupal user:password:reset

then enter userid,
then type new password.

Enjoy it.


in Drush > 9


If you have ssh access to the server, cd to the drupal root directory and run:

drush upwd --password="myNewSecretPassword" "admin"

Source: https://www.drupal.org/node/44164


If we don't know more about drush then we can change password from database in user table . We will edit password and select md5 then we can change password.


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.


Here you can generate the query and run it in your Drupal Database then the password will be reset http://btobac.com/reset-drupal-admin-password-mysql-query-phpmyadmin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.