2

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?

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.

1

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.