Manual:Resetting passwords

From MediaWiki.org

Jump to: navigation, search

Contents

[edit] Via e-mail

If you're able to easily find the e-mail address used with the account and update it, you can have MediaWiki send a 'forgot password' e-mail, which allows the software to change the password for you.

[edit] Maintenance script

Execute this script to change the password for username to foo

  php changePassword.php --user="username" --password="foo"

[edit] MediaWiki extension

An extension is available to reset passwords: Extension:Password Reset.

[edit] Direct database modification

To reset a password you can change the value of user_password field, in user's table. However, it's generally far easier and safer to change the e-mail address of the selected user and have MediaWiki reset the password using the "Forgot your password" feature (see below).

[edit] 1.13 and above

You should choose the salted or unsalted method depending on the value of $wgPasswordSalt in LocalSettings.php

MySQL unsalted:

UPDATE user SET user_password = CONCAT(':A:', MD5('somepass')) WHERE user_name = 'someuser';

MySQL salted (make sure both instances of "somesalt" are the same):

UPDATE user SET user_password = CONCAT(':B:somesalt:', MD5(CONCAT('somesalt-', MD5('somepass')))) WHERE user_name = 'someuser';

PostgreSQL unsalted:

UPDATE mwuser SET user_password = text(':A:') || MD5('somepass') WHERE user_name = 'someuser';

PostgreSQL salted (make sure both instances of "somesalt" are the same):

UPDATE mwuser SET user_password = text(':B:somesalt:') || MD5(text('somesalt-') || MD5('somepass')) WHERE user_name = 'someuser';

[edit] 1.12 and below

MySQL:

UPDATE user SET user_password = MD5(CONCAT(user_id, '-', MD5('somepass'))) WHERE user_name = 'someuser';

PostgreSQL:

UPDATE mwuser SET user_password = MD5(text("user_id") || text('-') || MD5('somepass')) WHERE user_name = 'someuser';