$100 Website Offer

Get your personal website + domain for just $100.

Limited Time Offer!

Claim Your Website Now

How to Reset admin password in Drupal?

How to Reset admin password in Drupal 7?

Drupal 7 stores a salted sha512 hash.

You can always use the user_hash_password(‘mypassword’) function (located in includes/password.inc) to make yourself a new one, then paste it into the database.

Create File on the root of Drupal run this file then you get the drupal hash password in Drupal 7 then go to your database and find user table then update the hash password.

Password is:- 123456

<?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('123456');
die();
menu_execute_active_handler();

?>

Method 1: Using Drush (Drupal Shell)

# Install Drush if not already installed
# Refer to Drush installation documentation for details

# Open your terminal or command prompt
# Navigate to your Drupal site's root directory

# Reset the admin password using Drush
drush upwd admin --password="newpassword"

Replace admin with your username and newpassword with the new password.

Method 2: Using MySQL Command Line

# Open your terminal or command prompt
# Access your MySQL database
mysql -u db_username -p
Replace db_username with your MySQL username.

# Select your Drupal database
USE database_name;
Replace database_name with your Drupal database name.

# Update the admin user's password
UPDATE users SET pass = md5('newpassword') WHERE name = 'admin';
Replace newpassword with your new password and admin with your username if different.

# Exit MySQL
EXIT;

Method 3: Using PHP Script

<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$new_password = 'newpassword';
$account = user_load_by_name('admin');
$account->pass = user_hash_password($new_password);
user_save($account);
echo 'Password has been updated.';
?>
  1. Create a new PHP file in your Drupal root directory (e.g., reset_password.php).
  2. Replace newpassword with your new password and admin with your username if different.
  3. Open your browser and navigate to the script (e.g., http://yourdomain.com/reset_password.php).
  4. You should see a message saying “Password has been updated.”
  5. Delete the script after use for security reasons.

Method 4: Using the Password Reset Link

  1. Go to the Drupal login page (http://yourdomain.com/user/login).
  2. Click on the “Request new password” tab.
  3. Enter the username or email address associated with the admin account.
  4. Follow the instructions sent to the email to reset your password.

Related Posts

The Comprehensive Blueprint for Free Vehicle Rental Management Software

Introduction The growth of the global vehicle rental industry has been fueled by a shift in consumer behavior toward the sharing economy. As travel demands rise and…

Read More

Comparing the World’s Best Heart Surgery Hospitals and Clinical Teams

Introduction The Growing Burden of Cardiovascular Diseases Cardiovascular diseases (CVDs) remain the leading cause of mortality globally, placing an unprecedented burden on healthcare delivery systems. Ischemic heart…

Read More

Affordable Website Design for Growing Companies: The Complete Strategic Guide

Introduction In the digital landscape, a website serves as a company’s modern storefront, primary lead generator, and foundational brand asset. For growing companies, startups, and small businesses,…

Read More

The Ultimate Guide to a User-Friendly and Mobile-Ready Business Website

Introduction A corporate website is no longer just a passive digital brochure; it functions as your primary storefront, lead generator, and brand ambassador. Over 60% of all…

Read More

Best Places to Visit in Goa: The Ultimate Travel Guide to Beaches, Nightlife & Itineraries

Introduction Finding the best places to visit in Goa means opening the door to a paradise that seamlessly blends laid-back coastal living with high-octane excitement. Whether you…

Read More

Best Countries for Plastic Surgery: Top Global Cosmetic Hospitals, Surgeons, and Costs

Introduction Deciding to undergo an aesthetic procedure is a deeply personal journey, and finding the best cosmetic hospitals in the world is the critical first step toward…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x