I forgot the password to the admin account A few month ago I have make a web-page using drupal. I had some break due to phd thesis. Now I want to push the subject foreward and finish the page, but I have forgot the admin's password. Is there a possibility to get it, or change it?

I tried the method described on http://drupal.org/node/1023428, but I got the following errors:


  PHP Warning: 
  include_once(/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/password.inc):
  failed to open stream: No such file or directory in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 83   Warning:
  include_once(/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/password.inc):
  failed to open stream: No such file or directory in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 83   PHP Warning:  include_once(): Failed opening
  '/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/password.inc'
  for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 83   Warning: include_once(): Failed opening
  '/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/password.inc'
  for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 83   PHP Warning: 
  include_once(/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/bootstrap.inc):
  failed to open stream: No such file or directory in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 84   Warning:
  include_once(/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/bootstrap.inc):
  failed to open stream: No such file or directory in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 84   PHP Warning:  include_once(): Failed opening
  '/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/bootstrap.inc'
  for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 84   Warning: include_once(): Failed opening
  '/var/www/localhost/htdocs/26_05_2012/zipshop/scripts/includes/bootstrap.inc'
  for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 84   PHP Fatal error:  Call to undefined function
  user_hash_password() in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 87   Fatal error: Call to undefined function
  user_hash_password() in
  /var/www/localhost/htdocs/26_05_2012/zipshop/scripts/password-hash.sh
  on line 87


Is there a possibility to change the password just through mysql-cient?
If the email you used to register the account is still active, or you still have access to it, then the easier way to change the password is using the "Request new password" link that appears in the login block, or the login page.



If you don't have access to the email you used to register it, you could change it in the "users" database table, and then request a new password.

If you don't have access to the database, but Drush is installed, then you can use the following command.

drush user-password &lt;username&gt; --password=&lt;password&gt;


Alternatively, you can use this command, which allows you to login as a user for once; once you are logged in, you can change the password for that account.

drush user-login &lt;username&gt;


The command return a link that can be used in the browser to access the site. If the username is omitted, the link is for the user #1.

If Drush is not installed, then you need to write a PHP file to change the password for the account. For Drupal 7, the following code works.

$account = user_load_by_name($username);
$edit['pass'] = $newpassword;
user_save($account, $edit);


Place the code in a file with extension .php, in the same directory containing the index.php file that comes with Drupal. Replace $username, and $newpassword with the username of the account you need to change the password, and the new password.

The following code work with both Drupal 6, and Drupal 7, but it requires you to know the user ID of the account.

$account = user_load($uid);
$edit['pass'] = $newpassword;
user_save($account, $edit);