How to change a user’s password in Mediawiki

If you have a wiki you may need to change a user’s password from time to time; you can do this from the back end quite easily. First, access mysql:

 

mysql -u root -p

 

Log in using your root password. Next, list your databases:

 

show databases;

 

On our test system this shows all of our databases like so:

 

mysql> show databases;
+——————–+
| Database
+——————–+
| information_schema
| mysql
| performance_schema
| press
| test
| wiki
+——————–+
6 rows in set (0.10 sec)

Select your wiki’s database:

 

USE wiki;

 

Replace “wiki” in the above with your own database’s name.

 

UPDATE user SET user_password = MD5(CONCAT(user_id, ‘-‘, MD5(‘newpasswordgoeshere’))) WHERE user_name = ‘usernameofuser’;

 

If this is successful you should get the following:

 

Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

 

If something has gone wrong (e.g. a non-existent username) you will get the following instead:

 

Query OK, 0 rows affected (0.03 sec)
Rows matched: 0  Changed: 0  Warnings: 0

 

All done! To leave mysql just type “exit”.