Skip to content

Instantly share code, notes, and snippets.

@gephaest
Created February 16, 2015 11:22
Show Gist options
  • Save gephaest/3019fe25a6ec916f79d3 to your computer and use it in GitHub Desktop.
Save gephaest/3019fe25a6ec916f79d3 to your computer and use it in GitHub Desktop.
Reset password for administrator in Drupal 7
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/password.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
db_query('UPDATE {users} SET pass = :hash WHERE uid = 1',
array(':hash' => user_hash_password('PASSWORD_HERE'))
);
die();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment