Reset password in Drupal 6 & 7 from database


For drupal6

UPDATE users SET name='admin', pass=md5('drupal') WHERE uid = 1;

For drupal7
define(‘DRUPAL_ROOT’, getcwd());
require_once DRUPAL_ROOT . ‘/includes/bootstrap.inc’;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once ‘includes/password.inc’;
$pwd = user_hash_password(‘NewPassword‘);

UPDATE users SET name=’admin’, pass=’$pwd’ WHERE uid = 1;

Advertisements

One thought on “Reset password in Drupal 6 & 7 from database

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s