1

I am using Drupal 8 and I forgot my admin password and have it blocked due to trying to login unsuccessfully 5 times. I am running my website in localhost.

How can I reset it in phpMyAdmin? Is there an sql query I could use?

closed as off-topic by No Sssweat, leymannx, Pierre.Vriens, Shawn Conn, DRUPWAY Jun 26 '18 at 13:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – No Sssweat, leymannx, Shawn Conn, DRUPWAY
If this question can be reworded to fit the rules in the help center, please edit the question.

3

Drush is ideal but if you don't have that installed, you'll need to do more than just a sql query because you'll need to get a hash of the password you want to use.

First find your core drupal main directory and run

php core/scripts/password-hash.sh "your_new_password"

In phpmyadmin or your sql db manager of choice find the admin user in users_field_data and replace the pass value with the hash you got from the command above.

Then truncate the 'cache_entity' table. If you were locked out from too many failed login requests also delete instances of your IP in the 'flood' table.

Then you should be able to log in with your new password.

0

with drush installed you can probably do

drush upwd USERNAME --password="SOMEPASSWORD"

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