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

Is there away of changing admin password through mysql?

#1
I forgot my admin password and unfort my email server isnt up yet and I cant get my password.. Is there away to change the admin pass hash to a well known one that way i can log in and change the pass
 
F

Floris

Guest
#2
Try to make a new admin.
set it up as super-admin
and remove the original admin as super-admin.

Then login to the acp, and change the pass on the first admin you forgot pass for.

Login as that one. reset it as super admin, and undo the other super-admin, and delete the temporary created super admin ?
 

Jake Bunce

XenForo moderator
Staff member
#3
The password information is serialized in the database so you can't update it with simple SQL.

In my testing I found that this works:

1) Register a new account. You need a working username and password.

2) Run this query on your database to flag that user as an admin:

Code:
UPDATE xf_user
SET is_admin = 1
WHERE user_id = 3;
3) Edit the library/config.php file and specify that user as a super admin:

Code:
$config['superAdmins'] = '3';
Separate by commas if there are multiple super admins:

Code:
$config['superAdmins'] = '1,2,3';
4) Now you can login to the Admin CP with full access. If you want the new admin to be permanent then you should setup proper admin permissions:

Admin CP -> Users -> Administrators -> Create New Administrator

Or you can edit the password for the old admin to regain access to that account:

Admin CP -> Users -> Search for Users -> [find the account, edit the password]