Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
1.3k views
in Q2A Core by
I've just set up Q2A site and forget my admin password.

Users has added many questions to the site so I can hardly reinstall.

So I need to reset password for admin though I haven't configure emailing in admin control panel.

Using 'forget password' brings me the error page saying `cannot send email`.

So, what can I do now to get back to admin page of my Q2A page?

2 Answers

+4 votes
by
selected by
 
Best answer

If you have access to the DB then just run this SQL query:

UPDATE qa_users
SET passcheck = UNHEX(SHA1(CONCAT(LEFT(passsalt, 8), 'new_pass', RIGHT(passsalt, 8))))
WHERE userid = 1;

Replace 1 with the user's id and 'new_pass' with the new password for the user.
Note the first user ID is usually the one you create during the installation.
by
Thank you. This is much simpler and got accepted.
+1 vote
by
edited by

1. Lock your site with basic authentication of Apache

2. Upload php script under qa-include folder after confirming userid of super admin with phpMyAdmin.

Script file name example: qa-reset-password.php

Code:

<?php
require_once './qa-base.php';
require_once './qa-db-users.php';
$userid = '1'; // Set userid of super admin.
$password = '12345'; // Change your favorite password.
qa_db_user_set_password($userid, $password);
qa_db_user_set($userid, 'emailcode', '');
3. Access script with your browser. e.g.
 
http://your_q2a_site/qa-include/qa-reset-password.php
 
4. Login as super admin. (password: "12345")
 
5. Change password with account page (password change form)
 
6. Delete upper script (qa-include/qa-reset-password.php) with FTP/SSH
 
7. Unlock basic authentication of your site
...