I have lost the password to login to my own drupal installation. Sounds silly, but Mozilla remembered it so well for months that now I have forgotten... and Mozilla too.

This wouldn't be a problem if Drupal could send me a new password, but for some reason it can't because this error message appears after introducing my userID in http://desdeamericaconamor.org/blog/en/user/password

Unable to send mail. Please contact the site admin.

Being myself the site admin, what can I do? :/ Also, I have requested previously new passwords and this function worked. This is a Drupal 4.5.1.

Comments

75th Trombone’s picture

I can't really help you with the mail issue, but if you have direct access to the database, I can help you there.

You need to browse the users table and find the record for your account. Then, in the Password field, input the MD5 sum for the password you want.

If you're using phpMyAdmin with MySQL, this is terribly easy. Go to the proper database, click "Browse" on the "users" table, and click "Edit" on your record. Type your password in plain text in the "Password" row, and under the "Function" column in that same row, choose MD5. Click submit and you're done! :)

t4him’s picture

I was setting up initial users and acceses, then my admin password would not work. I searched the forum and found this explination.

Thank You 75th. Trombone!

druplin4him

wellsy’s picture

how do you generate the MD5 sum password.

(I'm just an interested passerby)

wellsy

orchidsonline.com.au

t4him’s picture

Type your password in plain text in the "Password" row, and under the "Function" column in that same row, choose MD5. Click submit and you're done! :)

It is converted during the submit process via the MD5 function.

drupl'n4him

qgil’s picture

Hi! Forgot to say THANKS for helping me. This was the way I could use to recover my admin permissions.

expl0it’s picture

i figured it out

lsabug’s picture

Thanks!
Lsabug

Yann’s picture

Same here...

I installed Drupal without a problem before, but installing the Devel (spell check wants to change it to "devil"... ;) plugin broke everything and I couldn't figure out how to fix it so I deleted the Drupal install + database to restart with a fresh setup (I wasn't very advanced in dev process thankfully...) but with this fresh install, when I created the 1st admin account, instead f automatically logging me in like the first time, I got a "denied access" message once redirected to admin area. I tried the MD5 hack explained on here but now it doesn't do anything when I try logging in, no error message, just refresh the page as if nothing happened...

Drupal 5.1, MAMP 1.6

Any pointer in the right direction much appreciated!! Thx

underpressure’s picture

Thanks dude, built a site for some friends that have a metal band and shelved it until ready to deploy. Did so today and couldn't remember the password plus the email address used was incorrect. thanks a million.

rodolfoancheta’s picture

hey i tried the server2go, its great to have a view of the web sites when you dont have a server, or your servers access is limited, anyway, this little thing called server2go, have an Apache server, and support Drupal, but when i run the drupal, i create the first account, but it doesnt have a email service, so the mail will never be send, and i want to know if any way to log in whit out that email? i made that to see the databse whit the phpMyAdmin, but doesnt works... so if anybody know about please let me know
Thanks

rodolfoancheta’s picture

i did that whit the phpMyAdmin but.... when i click on submit, i see the password change, but in the same way (its look like 2D344gdsfdf434345....), and then when i try to log in, i write my userid and password and only accept it, but never log me in... do i have to change anything or what else do i have to do???

Drugerry’s picture

Thanks this really worked for me!

ayla’s picture

i have read too many pages trying to get into my offline site, with all the answers assuming i didn't already know about accessing through the '/user' page.

anyways, time to stop stressing and to start working on the site.

/grateful person

newtoid’s picture

very useful and clear explanation 75th trombone, cheers muchly

klynch3’s picture

I had the same issue and couldn't believe that I wasn't the only one ridiculous enough to do this! Thanks for supplying an answer, your solution worked like a charm.

floridaweb’s picture

For some reason my admin password would not work anymore and was getting concerned and frustrated, but thanks for showing how to correct it. Glad to see this work over 5 years later.

Billy Gallagher
Florida Web Presence LLC
www.floridawebpresence.com

jmcollantes’s picture

Drupal 7 no longer uses MD5 but SHA-256 (http://drupal.org/node/723802)

Just follow 75th Trombone instructions, but generate hash in advance following http://drupal.org/node/1023428 as it seems that mysql does not have a sha-256 function yet, at leat is not available on phpmyadmin.

Paste it in the 'pass' field from the 'users' table and you are good to go!

If you have been locked out after 5 failed retries, just empty the 'flood' table as in http://drupal.org/node/1023440

Happy drupaling!!!

venkat-rk’s picture

It looks like you disabled the login block.

1.)Go to your www.yoursite.com/drupal_install/user/login and you will be presented with the login screen.

2.) Click on the 'request new password' tab and in the screen that follows, type in either your admin username or email address and click the 'Email new password' button.

You will receive your new password at the email address you mentioned when you set up the site.

nicolaisen_nancy’s picture

Thank you ever so much. I am bookmarking this for sure..

jhenline’s picture

does anyone know if this process should work on drupal 5 as well? I have tried it and can't get logged in. I don't believe I forgot my password anyway; don't even think i mis-typed it when I created the account. What is interesting is that when I log in with my user and pass typed correct, the page just "refreshes" and bring me right back to the login page. When I log in incorrectly, I get a message saying login is incorrect.

I was poking around the database and the weak table between user and role doesn't have any data in it. I did create a record in that table to match my admin account with the admin role. Still....nothing.

Any ideas?

VM’s picture

try from a browser other than the one you are using. to see if its a cross browser situation and help diagnose.

MaraudeR’s picture

I've the same problem at my home with a Kubuntu Linux box, while in my production site with a FreeBSD does NOT fail, in both cases I'm using the same firefox browser so I think it's not a matter of browsers.

knugar’s picture

I tried to reset my Admin password as described here: http://occy.net/node/122

After resetting, I stil cannot log in.

Drupal makes a great job of hosting my site Nyfiken vital | Kost, hälsa & skönhet.

knugar’s picture

I use Konqueror during development, and swiching to Firefox seems to solve the problem. For more info: have my box been hacked?

Drupal makes a great job of hosting my site Nyfiken vital | Kost, hälsa & skönhet.

kb6nu’s picture

I'm having the same problem with a 5.1 installation. I can see that the password has been changed, but I still cannot login as the admin user. Has anyone figured out why this is and how to fix it?

awester’s picture

Hi,
I don't have phpMyAdmin so how do I access the database with the command line? The IT guy that set it up left, and I don't even know the db name or password. The email says its sending, but it never shows up. Any help would be greatly appriciated. Thanks.

VM’s picture

open your sites/default/settings.php file find the line $db_url and in that line you will see your db name and password.

WebKing’s picture

I can't believe you lost and mozilla too. No worries, next time you won't.
Sometime back I have read on this Linux blog about how your firefox can remember passwords for different sites and you can access it through one master pass. Isn't that cool?
You might want to read it...
http://blog.webgk.com/2007/09/master-password-in-firefox-remember.html

With Regards,
Sam

Phatchopolis’s picture

75th Trombone thanks for that phpMyAdmin trick. Operating in offline mode and my cookies got cleaned and I couldn't remember my pass. Worked a charm. Thanks again.

jscoble’s picture

This applies to MySQL. If you need to reset your admin password via SQL using the command line, btw, don't type , press the key ;):

  #mysql -u username -p -D databasename<enter>

enter password at password prompt

  mysql>UPDATE users SET password = md5('newpassword') WHERE uid = 1;<enter>

You'll see:
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings:0

to exit mysql.

  mysql>quit<enter>

Make sure you include the WHERE clause. Make sure the password you use is a secure one.

Log back into your site using your first user account and the newpassword.

You can do the same via a MySQL web client or gui.

ksharif’s picture

Thank you Jscoble it is really working

mysql> update users set pass=md5('admin') where name = 'admin';

Thanks again

CloudRunner’s picture

75th Trombone wrote:

If you're using phpMyAdmin with MySQL, this is terribly easy. Go to the proper database, click "Browse" on the "users" table, and click "Edit" on your record. Type your password in plain text in the "Password" row, and under the "Function" column in that same row, choose MD5. Click submit and you're done! :)

Followed this good instruction. Still unable to log in with previously set password. Just to be sure, I had copied the long password string that was existing in the phpMyAdmin password column. Restored it and then used that long string to log into my site which also uses Apache locally. Worked like a charm.

I may possibly have confused my keychain by developing two separate local sites and using the same passwords, even though each site has its own name. localhost/sitename and localhost/othersitename. But it is working now.

Thanks much, 75th Trombone

patrick.anglin’s picture

Quick question.

I promoted a page to front page and since then when I click on "Administer" nothing happens. What could have caused this?

P.

lwatson’s picture

I use Drupal to setup my website and by mistake i delete my admin account and what should i do to get access to my website buliding process.

VM’s picture

read: http://drupal.org/node/100252
where there is some sql to readd the addmin user directly into the DB

Augusto Ellacuriaga’s picture

It worked pretty well in a local server as described in the first comment. I'm using using XAMPP for Windows Version 1.6.5.

Thank you!

International SEO

arthur.duarte’s picture

Hi,

Thank you for this tip.

I configured SHA1 encryption and things got problematic for a while.

Now I switched to MD5 and it worked.

ABYOODA’s picture

i tried the `users` edit changing the password and putting function to md5 but i cant log in too...what else can i do? thanks

kenyob’s picture

I found out that Drupal 7 doesn't use MD5.
This was the easiest way to do it for me.
I used phpadmin and ran this sql statement.
I used the instructions from here: http://drupal.org/node/1023428

Reset admin password to "password" in Drupal
SQL
UPDATE users SET pass='$S$Cd059Vsxc8berFeg6hspaa7ejx2bSxyUisvCbT4h9o8XIgSUtPKz' WHERE uid=1;

Then I just changed my password to what I wanted.

Drupal Developer / technical Project Manager / online Marketing Consultant
Ux, seo, ppc, sem, social, analytics
Http://Www.briankenyon.com
Http://twitter.com/kenyob

Maricela-dupe’s picture

this instrctions (http://drupal.org/node/1023428) helped me too ! Tnx

Kersus’s picture

Thank you. Helped me big time. :)

Be furiously eclectic! http://www.furiouslyeclectic.com