How to recover drupal password in localhost?
You can update the password via mysql. You can run the following query in mysql to update password. The given hashed value is the hashed value of password: NewPassword

UPDATE users SET pass = '$S$DRSUIz9NFfxOXKPveQ00UTGMzsJe62LjYvVHfYJ8I8wuy4zRqVBK' WHERE uid = 1;


For detailed instructions go through these article Resetting the administrator password with sql-query (Drupal 7)