Skyline Groningen
Toegevoegd op

Reset forgotten admin password in Drupal

In some cases it can happen that the password of the admin is lost. Email to retreive password is not send or send but to unknown account. Actually, you managed to close your own site for yourself. In this case you can reset the password, at least when you have access to the database and the root of your server. Create a new php file (for example password-reset.php) and copy this code into it. Do not forget to replace 'your_new_password' with the wanted password. <?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('your_new_password'); die(); menu_execute_active_handler(); ?> Move the file to the root of your domain and open it in a browser (e.g. yourdomain.com/password-reset.php) Your browser will show you the hashcode which you can copy/paste to the correct user in the table users (or with prefix if you use it)