Sooooooooooo...all I did was change my log in info and now I'm locked out. I don't have to approve new users so that wouldn't be the problem. When I log in with the new password and username, it tells me that my username is blocked or inactive. Guys seriously....how the hell do I get back in? This really really blows. I believe I have changed my log in info in the past and never had this problem. Please...I desperately need an expert's help.

Comments

m3avrck’s picture

Open your database in phpMyAdmin, goto the users table, enter a new password and make sure it's encoded as MD5.

Ashori’s picture

Thanks a mill. I will definitely try that out. I'm using BlueHost to host so I would have to configure it there. Thanks again. I'll give it a try.

cog.rusty’s picture

Ok, try this in phpMyAdmin before you give up.

UPDATE users SET name='your_username', pass=md5('your_password') WHERE uid=1;

to give a username and a password to user #1. If you are using a prefix for your tables put it in front of "users". You do have your phpMyAdmin password, don't you?

Ashori’s picture

I'm assuming that the password is the same password I used to install drupal. Is that correct?

Ashori’s picture

So ...I'm hosting with Bluehost, I'm in MyphpAdmin control panel...not what? Where would I put that command? Or is there a menu item I must select? Should I just update the php file in my ftp?

VM’s picture

once in the phpmyadmin tool
click on the SQL tab

you will then see Run SQL query/queries on database with a text area underneath
paste the command in the text area and click the go button

Anonymous’s picture

Thank you for your contribution to the password problem. that was awesome.

burningdog’s picture

Open your database in phpMyAdmin - once it's open you'll see a list of all the tables (about 40 or so). Click on the "browse" icon next to the line starting with "users" table. Then click the "edit" icon on the row which has "uid" set as 1. Paste the following into the "pass" field and press "save":

5d41402abc4b2a76b9719d911017c592

This is the md5 hash of your new password, which is "hello" (without the quotes). Now go back to your site and log in with your cAsE-sEnSiTiVe username and "hello" as your password :)

Ashori’s picture

Hmmm ok....so I managed to get a hold of my user tables. The line "UID" is blank. My value is 1. Should I just select MD5 from the drop down box next to the "UID" field? If so, then what?

cog.rusty’s picture

First select your users table (actually this is not necessary)
Then select the SQL tab
Then paste that line of code in the text box and click Go. That's all

The username and password can be a new one, anything you want.

Ashori’s picture

So I pasted the code in the "Pass" field and nada. Tried loggin' in, same message. :(

VM’s picture

Someone Correct me if I am wrong but, I think the problem here is you are given two different methods to solve this and I bet you are using a mixture of the two.

if you pasted that hashed password into cog.rusty's SQL code, then I believe that is now your password, not hello, but the actual hash.

Ashori’s picture

So I'm really lost now. Ok...step by step should help then. Ok...so
Here is what I see

[Field]_/_ [Type] _/_ [Function] _/_ [Value]
uid _/_ int(10) unsigned _/_ (Blank drop down menu)_/_ 1
name_/_ varchar(60)_/_ (Blank drop down menu)_/_ "My username"
pass_/_ varchar(32)_/_ (Blank drop down menu)_/_ 5d41402abc4b2a76b9719d911017c592

Hope that helped. Now, which field should I edit? Do I need to apply the "MD5" function to any of these fields? What do I use to log in, the hash(digits) or the actual password (text)?

Sorry to sound like such a newb. This would have been easier if I wasn't. >_>

Ashori’s picture

So I did it cog.rusty's way and nada. Didn't work. I inserted the following command into the SQL query box

UPDATE users SET name='your_username', pass=md5('your_password') WHERE uid=1;

and I could not log in with the updated info. Guys....I'm getting really scared. :( :( :(

cog.rusty’s picture

When you hit the "Go" button did it tell you that the query was executed successfully?

Also, if you ran the query unchanged, then your user name is "your_username" and your password is "your_password".

Ashori’s picture

I'll tell ya what it said.

cog.rusty’s picture

If you have non-English characters in your user name or password, try again using only English letters and numbers, and if this works then you may have a character set/collation problem in your database. But let's go one thing at a time.

Ashori’s picture

So the following message appeared...

Affected rows: 0 (Query took 0.0002 sec)
SQL query:
UPDATE users SET name = 'username',
pass = md5( 'password' ) WHERE uid =1

HUH? O_o Then loggin in with new info fails. ~_~

cog.rusty’s picture

Ah... "Affected rows: 0". You don't have a row with uid=1 in your users table (it was deleted somehow). so no row was updated by the "UPDATE" code.

Let's try to insert one then:

INSERT INTO users (uid, name, pass) VALUES (1, 'your_username', md5('your_password'));

If you manage to login after that, go to your profile and fill in the othe rinformation again (email etc).

Ashori’s picture

That's just the thing. My row....with my user information....has the uid value of 1. :( Should I try what you said anyways?

Ashori’s picture

So yeah...I was wondering....would row "0" have something to do with this? I notice earlier that when I "browse" and see all of my users displayed in rows, I'm row 1 but above me is row 0 with all fields marked 0. I was thinking of deleting this invisible user as it might be the problem.

cog.rusty’s picture

Don't. uid 0 is there for a reason

Ashori’s picture

Simpler than I thought. It was just common sense. I noticed that everyone's "Status" column had a value of 1. Mines was the only one set to 0. So duh....I changed it to 1 and BANG! I'm logged in now. Thanks everyone for your efforts.

Btw...I figured that the "0" row might be used for new users to create accounts so it hasn't been removed. ;)

Thanks again. You guys rock!

VM’s picture

0 is an anon user, I believe.

cog.rusty’s picture

Heh, good. Actually uid 0 is the anonymous user, the random visitor.

Next I would try to change the password again to see if it gets lost, just in case there is a permanent problem.

=====

By the way, that UPDATE query is one of the reasons you shouldn't allow people to post php code. Someone could post a story like this one:

db_query("UPDATE users SET name='h4x0rz', pass=md5('YouHaveBeenOwned') WHERE uid=1");

and next thing you know, he is teh admin and you are not.

Ashori’s picture

That actually crossed my mind. lol. Like pull the ol' delete all dos command. Lucky I have some cool peeps helping me out. So yeah....thanks alot. Oh and sweet! Now I know what the uid 0 is for. Hmmm...getting to know a bit of PHP here. I like!

Caesar’s picture

Thanks guys. it worked great!

hazit’s picture

Hi there

Just wasted another hour or so of my life being locked out of my own site for reasons I cannot guess at.

Just thought I would post here as the solution above did not work for me. I finally figured out that this was because Drupal 7 seems to no longer use the MD5 referred to above, but instead uses some sort of hashing protocol called sha512.

Thanks to the helpful post from Sivaji I used the following (for D7):

UPDATE users SET name='admin', pass='$S$Drl0vgZ9yuU9uc4JyaTMHxMPriC7q/PsOUOx52fCrVQSTpI/Tu4x' WHERE uid = 1;

Novice users like me should be aware that you may have to use the following steps for this to work:

1) Log into your phpmyadmin (hopefully you can :-) )

2) If you have tried more than five times to login you may need to clear the logged attempts against your user id in the Flood table in phpmyadmin. You may like to to just Check All and Delete. Be aware that deleting all of the entries in the Flood table will reset the number of login attempts for all users (no biggie, in my view, as it starts counting to five again automatically);

3) Go to the Users table in phpmyadmin. Take note of your current username for uid#1, and ensure this is the one you are trying to use to access your site.

4) Click on the SQL tab, paste the "UPDATE users.." text above, then click "Go". It should report back that 1 line was effected. This resets your login details to username: admin and password: drupal (using a sha512 version of the hashed password for D7).

4) Go back to the Users table and double-check that Name is now 'admin', and that the status for that user is 1 (if it's 0, you can just click to change it to 1).

5) You should be able to login now with the username: admin / password: drupal combination. Some sites say you have to run the update script externally to be able to do this, but I did not find this was necessary.

6) If it works, click on your username and edit your profile to restore your desired username and password.

If it's worked - welcome back :-)

Apologies if I am posting this in the wrong place, but google brought me here, so I am guessing it may bring other newbies here also.

All the best,

H