To recover drupal admin password .We can use some below method
1) Use drupal built in function i.e user_hash_password(‘newpassword’);
put below code in your drupal theme index.php’s bottom of the page to see new hashed password .Here we consider new password is ‘admin’ .You can put whatever you want
Now refresh the drupal home page on browser ( http://localhost/drupal_folder )
you should see a new password hashed generated on bottom of the page.
Copy this password then remove the code put on index.php .
Now open http://localhost/phpmyadmin .
Access your database’s ‘users’ table .
There on password field replace it with your copied password where uid is 1 .
That’s it Now check by login on drupal admin from http://localhost/drupal_folder/user
2) Install a new drupal to get password from phpmyadmin
You can install new drupal ,while installing remember it’s password .
After installation open phpmyadmin access the database of this new drupal instllation. Find it’s ‘users’ table .There copy password where uid =1 .
Now open your previous drupal database’s table which password you have forgot , replace the password where uid =1 shows .
You should now able to login from your drupal admin .