If you forget any user’s password (say, your own) for your local mediawiki database like I did, you’ll probably find this helpful.
In my case I’d forgotten the admin password for our mediawiki wiki. Although all our pages are able to be publicly edited and users could still log in and do what they needed to do, the loss of the administrator account had to be fixed pronto.
Wiki uses password hashing based on the user ID so you need to do this:
- Find the value for user_id for the user you want:
SELECT user_id FROM user WHERE user_name=’forgotten_user’;
Note: wiki capitalises some of my user IDs so you might like to try a variation like this:SELECT user_name,user_id from user;
And match the user_id number to the username you want.
- Create a new password using this user ID:
UPDATE user SET user_password=MD5(CONCAT(‘<user id result>-‘,md5(‘newpassword’))) WHERE user_id=<user id result’>;
Don’t forget the dash after the CONCAT. For example, if your user ID is 1, as in the case of the wiki administrator account, you’d use…MD5(CONCAT(‘1-‘,md5(‘newpassword’)…
That should do it!