Skip to content

Instantly share code, notes, and snippets.

@cdnsteve
Last active December 18, 2015 04:18
Show Gist options
  • Save cdnsteve/5724222 to your computer and use it in GitHub Desktop.
Save cdnsteve/5724222 to your computer and use it in GitHub Desktop.
Place this in your /root drupal directory. Change NEWPASSHERE to the new password for the root user. run yoursite.com/drupal-password-reset.php Take the output new password hash then go into MySQL and enter it, replacing: PASSWORDHASHOUTPUT This updates the admin user account to the new password.
<?php
/*
* Resets password, copy this into Users table in MySQL
* Drupal 7
*/
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('NEWPASSHERE');
die();
menu_execute_active_handler();
/*
* this gives hash then run:
* UPDATE users SET pass ='PASSWORDHASHOUTPUT' WHERE uid = 1;
* If blocked by temporarily blocked run this:
* DELETE FROM `flood`;
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment