Resetting the admin password in Drupal 8

24/02/2016
Resetear password del admin en Drupal 8

From the Root Document of our Drupal, we execute the following command:

php core/scripts/password-hash.sh 'nuestro nuevo password'

password: nuestro nuevo password    hash: $S$EMaSRYWmiS.asVxBjJDvl9OLSfpYuEWD/j7lW6Xa0R7BK4NIV6az

 

As we can see, we have obtained a chain of text (hash) that should allow us to overwrite in our database.  Once we are in the console of our database, and knowing that our admin user has the UID 1, we execute the following search:

UPDATE users_field_data SET pass='$S$EMaSRYWmiS.asVxBjJDvl9OLSfpYuEWD/j7lW6Xa0R7BK4NIV6az' WHERE uid = 1;

 

At this point, if we try to log in to Drupal, the system will respond saying that the password in incorrect.  This is due to the Dupal´s cache, with blocks the login system from directly reading the table users_field_data.  To fix this, we execute the following search in our BB.DD.:

DELETE FROM cache_entity WHERE cid = 'values:user:1'

 

 

With these simple steps, we can return to login to the system with our new password. :-)

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.