• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Password Reset Query

A database query to reset a user's password. Useful for recovery of admin login.

Jake Bunce

XenForo moderator
Staff member
#1
Jake Bunce submitted a new resource:

Password Reset Query (version 1.x) - A database query to reset a user's password. Useful for recovery of admin login.

You can use this query to reset a user's password. It is especially useful if you forget your admin password.

You need to replace new-password and 1 (the user_id). You don't have to change salt, but if you do then both instances need to be the same.

Code:
UPDATE xf_user_authenticate
SET data = BINARY
	CONCAT(
		CONCAT(
			CONCAT('a:3:{s:4:"hash";s:40:"', SHA1(CONCAT(SHA1('new-password'),...
Read more about this resource...
 
#2
Jake,
I just finished the xenforo install, and I've already lost the administrator password. I tried using the query you posted, and though it was performed successfully, I still couldn't log in using the new set password.
 

Jake Bunce

XenForo moderator
Staff member
#3
Jake,
I just finished the xenforo install, and I've already lost the administrator password. I tried using the query you posted, and though it was performed successfully, I still couldn't log in using the new set password.
Is there an error? Does it say the login is incorrect?

The query works fine in my testing. Maybe you specified the wrong user_id or ran the query on the wrong database or something.
 
#4
Well it just said wrong password. I checked the query 3 times to make sure that the user_id, password and database is correct. But nevermind the problem is solved now. I reinstalled xenForo and started with a new database.
 

gldtn

Well-known member
#5
Jake, how would I add a new user through the database? I added myself to the xf_user by copying another user already on the database, than I also added myself to the xf_authenticate and used the query u provided above, but It keeps saying my password is wrong :/

Thanks in advance!
 

Jake Bunce

XenForo moderator
Staff member
#6
Jake, how would I add a new user through the database? I added myself to the xf_user by copying another user already on the database, than I also added myself to the xf_authenticate and used the query u provided above, but It keeps saying my password is wrong :/

Thanks in advance!
http://xenforo.com/community/threads/script-to-create-a-new-user.21286/#post-270084

If you are missing the joined record in any of those tables then it might result in "user not found" kind of errors.
 

XenBurger

Active member
#7
@Jake Bunce - im unable to respond to your reply on my review. My point was that your instructions say you should "replace" 1. But quite often "1" is "admin".

So it should not necessarily be replaced. This confused me because it is a big part of the very short instructions.

My Admin ID was 1, so I wasn't supposed to change it, and I felt like I was not following the instructions.

I'd recommend saying:

"Replace 1 with whatever user ID is associated with your Admin account. If it is already 1, you do not need to change this".