In this blog, I am showing how you can reset magento admin password if you lost it and cannot recover using Forgot Password option. I assume that you have the server access of magento i.e Database and FTP access.
For this you have to create a file named reseradminpass.php and paste the bellow code into this file and upload it in your magento root directory.
/* not Mage::run(); */
## For magento1.7 or Earlier var
//$_HASH_SALT_LENGTH = 2;
## For magento1.8 and magento1.9
$_HASH_SALT_LENGTH = 32;
#Generate admin password
$password = "admin1234";
echo $adminPass = Mage::helper('core')->getHash($password, $_HASH_SALT_LENGTH);
## And reset password field in "admin_user" table
Here the variable $_HASH_SALT_LENGTH is for salting the password (set 32 for magento1.8 and magento1.9 and set 2 if your magento var is 1.7 or earlier).
Now browse the file as www.yourwebsite.com/reseradminpass.php. Hence, you can see the new password. So, copy it and replace the password field in “admin_user” table.
And that’s it, now you are able to login from admin using by this given password.