Programmatically change the user's password Drupal With Drupal API $user = \Drupal\user\Entity\User::load($uid); $user->setPassword('newpassword'); $user->save(); With Drush Drush 9+ drush user:password admin "newpassword" Drush <8 $ drush upwd 1 --password="newpassword"