3

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 Answers 2

5

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=##";
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
  • 1
    @arpitr, that is the wrong command, this is a question regarding changing a username, not a password. Commented Aug 3, 2016 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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