Skip to main content

How to reset the Drupal 8 admin user frontend password?






In this post we will know, how can we reset the Drupal 8 frontend admin user password. It is very easy just you have the server access to run the following commands - 

Generate a new password 

First, you have to generate a password hash that is valid for your site. Execute the following commands from the command line, in the Drupal 8 root directory: 

php core/scripts/password-hash.sh 'your-new-pass-here'

Output: 
password: your-new-pass-here hash: $S$EV4QAYSIc9XNZD9GMNDwMpMJXPJzz1J2dkSH6KIGiAVXvREBy.9E 


Be careful not to include more or less characters as the hash. These hashes look somewhat like - 

$S$EV4QAYSIc9XNZD9GMNDwMpMJXPJzz1J2dkSH6KIGiAVXvREBy.9E. 



We will use the generated password later. 

Update the user password. 

Now you need to update the user password, in our case we need update the Administrator password, fortunately the UID for Administrator is 1 equal to previous versions of Drupal.  

With the new password we need run the following SQL statement

UPDATE users_field_data SET pass='$S$E5j59pCS9kjQ8P/M1aUCKuF4UUIp.dXjrHyvnE4PerAVJ93bIu4U' WHERE uid = 1;


Dealing with Cache 

At this point if you try to login in the Drupal 8 website you will rejected, it's because the login system don't read directly the table users_field_data instead of a cache for entities is used. 

To flush the cache for a specific user entity with compromise the rest of cache of your system you can use the following SQL statement. 

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

Enjoy you I have successfully reset the Drupal 8 frontend admin user password.


Credit: weknowinc

Popular posts from this blog

WordPress Site is not loading properly behind Google Cloud/AWS Load Balancer

Hello Guys, Today we are going to understand how can we fix a WordPress loading issue (CSS and JS loading issue) behind the Google Cloud Load Balancer or AWS Load Balancer. Generally, When we host a WordPress site directly with Google Cloud Compute Engine VM instance or AWS EC2 instance. It's loading perfectly fine. But once we added this WordPress server behind any Load Balancer either from GCP Load Balancer or AWS Load Balancer, you site will completely broken, means the CSS and JS of your site not loaded properly. The reason for this is - When you put a load balancer in front of WordPress, you need to modify wp-config.php to process the HTTP header HTTP_X_FORWARDED_PROTO to detect the protocol that the user is using and not the protocol the load balancer is using to connect to your backend. To fix this issue, we have to make following changes in the  wp-config.php  file and add the below code snippet on the top of  wp-config.php file - Google Cloud Platform Load Bal...

How to Convert PEM KeyFile into PPK KeyFile and vice versa?

Hi, In this post, we will learn that how can we convert PEM KeyFile into PPK KeyFile and vice versa including the installation of the tool which we will use to accomplish this. For the Windows Operating System In Windows system is easy and straight forward. You just need a tool called "puttygen.exe" from the URL -  https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html Choose the appropriate version as per your OS. Convert PEM into PPK in Windows After downloading the PuTTYgen and open it, load your file (select All Files (*.*) in the bottom dropdown to select your PEM key file).  You will get a message Successfully imported foreign key, Just click OK, Now click on Save private key button to save that key in the location where do you want to save it. Convert PPK into PEM in Windows Now we will convert PPK file into PEM using PuTTYgen in Windows PC Open the PuTTYgen tool, now load your PPK file into it, and finally, Go to Conversions Menu and Click on Export OpenSSH k...

Git and GitHub Commands Mastery

1. Setup Git and GitHub Global Configuration  git config --global user.email "gautamthakur1983@gmail.com" git config --global user.name "Gautam Thakur" git config --global list git config --list 2. Git Lifecycle | Initilize, Status, Add, Commit git status git init git add git commit -m "Commit Message" git log git log --oneline 3. Git Difference between last commit changes and current version changes git diff 4. Git Compare between 2 different Git Commits git diff eac4c5b 82485b1 5. Git Statsh - To save some changes for temporary purpose ## Pop take out stash and clear but apply take out stash but not clear git stash (To save current changes for temporary) git stash pop (To take out all stash contents) git stash list git stash clear (To clear all the stash changes) git stash save "NAME"  git stash save "NAME1" (Working with multiple stash) git stash sapply 0 or 1 (0 for name, 1 for about) after that run git stash clear git stash clear 6...