Hello peopele,
How do I recover my password if all I get is
"warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. " error when trying? any help???
THanks

Comments

francort’s picture

I can give you some tips. I've never faced such a problem but i think what you can do.
The information is inside you database in users table password for user with uid 1.
In user.module there is the function who load a user. That function is user_load. It uses md5() for encryption( see php reference for more details ).
You gonna need to read somethings, but i hope what i've written is gonna be a good start point

good luck!

copy’s picture

Thanks for the reply
THis surely hints something
thank you once again
have a nice day

yuriy.babenko’s picture

Open Drupal's index.php file in the site root and right after

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

put:

$pass = md5('123');
$query = "UPDATE {users} SET pass='%s' WHERE uid=1 LIMIT 1";
db_query($query, $pass);
echo 'done';
exit();

Then open any page on your Drupal site and you should see the text 'done'. At this point remove the above code from index.php and login with your admin user (uid = 1) and password '123'. Change password to something more secure :)

absolutezero273c’s picture

My apologies, but I am completely new to drupal. My sys admin who was responsible for our drupal site has left the company and I am trying to recover admin rights so I can begin maintaining it. I have an account on the machine which has admin rights but the password has changed and need to reset it.

I've modified my index.php file as described above, but have changed the uid to equal what is set for my account. Unfortunately I am receiving the following error after modifying the last line above "?>":

Parse error: syntax error, unexpected '<' in /usr/share/drupal5/index.php on line 18

Thanks for any help.

francort’s picture

.

francort’s picture

Don't use "<?php" and "?>" tags. Copy/paste just what is inside those tags.

absolutezero273c’s picture

Thanks. I tried that, but am getting different errors now:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/share/drupal5/index.php:7) in /usr/share/drupal5/includes/bootstrap.inc on line 900

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/drupal5/index.php:7) in /usr/share/drupal5/includes/bootstrap.inc on line 531

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/drupal5/index.php:7) in /usr/share/drupal5/includes/bootstrap.inc on line 532

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/drupal5/index.php:7) in /usr/share/drupal5/includes/bootstrap.inc on line 533

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/drupal5/index.php:7) in /usr/share/drupal5/includes/bootstrap.inc on line 534
done

Do you have any other recommendations?

Thanks, again.

francort’s picture

That's because of the <?php echo 'done';?> line. Anyway, password might have been reset to "123".
You can see username of user with id=1 in your database, and now you know what password is :)

absolutezero273c’s picture

Thanks for the help francort!

ainigma32’s picture

Status: Active » Fixed

Solution provided so setting to fixed.

- Arie

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

maytechu’s picture

Version: 6.4 » 6.9
Assigned: Unassigned » maytechu
Status: Closed (fixed) » Active

I am sure I'm entering the right user name and password, but it doesn't let me. I wrote it down when I installed drupal this morning!!!!
Is the user name case sensitive? I doubt it, anyway.

I need to reset this as soon as possible, it is installed in my localhost so I can't get e-mails .....

maytechu’s picture

Hi!

I have done all of the above. I got the page done. I have removed the text and save the file. I've tried to login with username: 1 and password: 123, but I get the same result. It must be something else..... I know it sounds stupid, but normally I do not mess with usernames and passwords and I wrote this down...

maytechu’s picture

Hi Thanks. I fixed it. I mean you did. I just didn't read properly your instructions.

Thanks a million.

stevenpatz’s picture

Assigned: maytechu » Unassigned
Status: Active » Closed (fixed)
deltaag’s picture

yuriy,
This is great. I had this problem and your code solved it.
Thank you very much.
I love the community support of Drupal.
Thanks again.

mcurry’s picture

*subscribing*
@ yuriy.babenko: Worked like a charm - thanks for that.

jacobroufa’s picture

A great tip to have! Throwing this in my bag'o'tricks for sure!

digitalpbk’s picture

UPDATE users SET pass = MD5('password') WHERE uid = 1 

See more @ Reset admin password on drupal

salem2’s picture

Assigned: Unassigned » salem2
Category: support » task

thanks it's work for me

lnachiappa’s picture

@digitalpbk
Great tip ,thanks a lot (i am using postgresql, and drupal 6.19 where also this worked)

Batman&#039;s Byte’s picture

This worked and was really easy.

syodash’s picture

yuriy.babenko your tip save my ass, Four years later THANKS!.