You have several ways to achieve this:
- Visit yousite.com/user/password then enter your email address and you'll then receive an email with a link to reset your password on your Drupal site.
With drush, you have two different ways of doing things:
$ drush uli --uid=1 --uri=http://yoursite.com
This command will return a URL that will allow you to log in to the site without actually knowing your admin password. Handy.
Or as previously suggested by @Nitesh Sethia, using drush, again, to reset your admin password:
$ drush upwd <username> --password="<newpassword>"
Another interesting option is to use the password-hash.sh script that ships with Drupal. At the root of your Drupal codebase, type:
$ ./scripts/password-hash.sh <newpassword>
This will return a hash with the SHA 512 security. Copy that hash, now log in to your MySQL prompt or via phpMyAdmin (or whatever other GUI of your choice). Select the "users" table and update your admin account by replacing the "pass" hash by your newly generated one. Save. Done. Assuming you'll go for the MySQL prompt and will want to reset UID 1 (superuser) password, run:
mysql > UPDATE `<yourdatabase>`.`users` SET `pass` = '<yourhash>' WHERE `users`.`uid` = 1;
Last option that I wouldn't recommend is to temporarily hack your index.php
file so that, under drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
you add:
require_once 'includes/password.inc';
echo user_hash_password('<newpassword>');
die();
Now hit the homepage, copy the hash, and update the "pass" field in the database as explained previously. Revert the changes in index.php
. Done.