How to change a user's password?

From Cosmin's Wiki

Jump to: navigation, search

Assuming that $wgPasswordSalt is set to true (the default), you can use the following SQL query:

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

Where obviously "somepass" is changed to the password you want to set and "someuser" is changed to the user name as it is listed in the table "user".

If $wgPasswordSalt is set to false, the SQL becomes:

UPDATE user SET user_password = MD5('somepass') WHERE user_name = 'someuser';

Note: the user_id in the CONCAT string is a column name and is not meant to be replaced with 'someuser'

Note: For error of table 'dbname.user' does not exist, please check the LocalSettings.php for $wgDBPrefix, the user table might be named to ($wgDBPreix)user.