1

To change a password I would use:

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

Is there a similar way to change a user's name using Drush from the command line?

2

There isn't a built in Drush command, but you can use Drush's sql-query command (or sqlq shorthand) to update the user's name:

drush sql-query "update users set name='SOMENEWNAME' where uid=####"

Where #### is the user's uid and users is the user table.

  • 1
    @arpitr, that is the wrong command, this is a question regarding changing a username, not a password. – nicholas.alipaz Aug 3 '16 at 0:52
0

Just an update for those looking for this for Drupal 8.6+. The query should be

drush sql-query "UPDATE users_field_data SET name='somenewname' WHERE uid=##";

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.