How to reset the admin password in Drupal

PHP Scripts | Updated 2026

If you are locked out of your Drupal admin panel, you can reset the password via command line (Drush) or directly in the database.

Method 1: Drush (If Available)

Reset via SSH

If you have SSH access and Drush installed:
cd ~/public_html && drush user:password admin "NewPassword123"

01. Method 2: Reset via phpMyAdmin

For Drupal 7:

UPDATE users SET pass = MD5('NewPassword123') WHERE name = 'admin';

For Drupal 8/9/10, the password hash is more complex. The easiest approach is to use the one-time login link: add /user/password to your site URL to request a password reset email.

If email is not working, generate a login link via Drush: drush user:login

Drupal 8+ Note

Drupal 8 and later use bcrypt hashing, not MD5. The MD5 method only works as a one-time login trick on Drupal 7. For Drupal 8+, use Drush or the password reset email. After any MD5 reset, log in and change the password through the admin UI immediately.

For other CMS password resets: Joomla, osCommerce, Zen Cart.

Locked Out?

Open a Support Ticket

Quick Recap

  1. Drush: drush user:password admin "newpass"
  2. Drupal 7 DB: UPDATE users SET pass = MD5('newpass')
  3. Drupal 8+: Use /user/password reset link or Drush
  4. Change password again through admin UI after MD5 reset
  5. Back up before changes

CMS password recovery · Last updated March 2026 · Browse all PHP Scripts articles

  • 155 Users Found This Useful

Was this answer helpful?

Related Articles

How do I reset Joomla administrator password?

PHP Scripts | Updated 2026 If you have lost your Joomla administrator password and cannot log...

Turn off PHP error messages via htaccess

PHP | Updated 2026 Quick Answer To disable PHP error messages from displaying on your...

PHPList Email Throttling

PHP Scripts | Updated 2026 PHPList is an open-source email newsletter manager. If your...

Coppermine Gallery cannot create thumbnails

PHP Scripts | Updated 2026 If Coppermine Photo Gallery cannot create thumbnails or...



Save 30% on web hosting - Use coupon code Hosting30