How to reset Drupal Admin Password

How to reset Drupal Admin Password

How to reset Drupal Admin Password
Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Resetting the Drupal admin password depends on the version of Drupal you are using.

How to find Drupal version number?

Click here to check our tutorial on How to find Drupal version number.

Resetting Admin password in Drupal 7

Step 1: Generate a password hash

Create a file with .php extension with the following code and upload it to the server. I am calling this file as “pwd_reset.php”

<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . ‘/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once 'includes/password.inc';
echo user_hash_password('SomeSecurePassword');
die();
?>

Replace “SomeSecurePassword” with the password of your choice. Make sure you are using a secure password.

Step 2: Browse to the pwd_reset.php file

Open the password reset file in your browser. For example, if your domain is domain.com then open the following URL in your web browser.

http://www.domain.com/pwd_reset.php

The browser will display a long hash string. Copy this string to notepad.

Step 3: Update your password

Login to your Drupal database through phpMyAdmin or any remote method. Browse to the “users” table. Edit the user you want to change the password for and paste the hash string in the “pass” field.

You should now be able to login to Drupal using your new password.

Resetting Admin password in Drupal 6

Login to your Drupal database through phpMyAdmin or any remote method. Browse to the “users” table and find the user you want to change the password. Get the “uid” of the user and run the query below in the SQL window. For example, if the uid of the user is 1, the SQL query will look something like the one below.

UPDATE users SET pass = md5('SomeSecurePassword') WHERE uid = 1;

Again, replace “SomeSecurePassword” with the password of your choice. Make sure you are using a secure password. You should now be able to login to Drupal using your new password.

Rating: 5.0/5. From 1 vote.
Please wait...
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Related Post