Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change a user's Drupal password with Drush?

Tags:

Is it possible to change a user's Drupal password from the command-line with Drush?

like image 897
markdorison Avatar asked Feb 13 '11 22:02

markdorison


People also ask

What is the use of Drush in Drupal?

Drush is a tool in Drupal 8, which helps perform various tasks like website installation, configuration, and update from the command line. A website may require an update due to several reasons, such as security issues. Choosing to update the modules via conventional methods proves to be time-consuming task.


2 Answers

If you're running Drupal 7, using md5 won't work as passwords are salted. However, if you have drush 4.x, you can use the user-password command:

drush user-password someuser --password="gr3@tP@$s" 
like image 95
jhedstrom Avatar answered Nov 03 '22 01:11

jhedstrom


Yes. Here's an example for resetting the password of the Drupal admin user given that you know the UserID (uid):

drush sqlq "update {users} set pass=md5('new_password_here') where uid=1" 
like image 28
Fitz Avatar answered Nov 03 '22 01:11

Fitz