Mediawiki – recover admin rights

Let say you have MediaWiki installation but you lost admin credentials. If you have other account or if you could create one without any rights we’re in home 😉
We have few options to do this.

Reset admin password

We have to connect to database and use this SQL:

UPDATE `user`
SET user_password = CONCAT(
   SUBSTRING(user_password, 1, 3),
   SUBSTRING(MD5(user_name), 1, 8),
   ':',
   MD5(CONCAT(SUBSTRING(MD5(user_name), 1, 8),
   '-', MD5('new password'))))
WHERE user_name = 'Admin';

Just replace Admin with your username and new password with your password.

Raise another user rights

If we don’t want to mess with admin account we could raise permissions for other user, ex. Tom:

INSERT INTO user_groups (ug_user, ug_group)
VALUES(
  SELECT user_id
  FROM user
  WHERE user_name = 'Tom',
'bureaucrat');

INSERT INTO user_groups (ug_user, ug_group)
VALUES(
  SELECT user_id
  FROM user
  WHERE user_name = 'Tom',
'sysop');

Source:
http://www.mediawiki.org/wiki/Manual_talk:Resetting_passwords
http://www.mediawiki.org/wiki/Manual_talk:AdminSettings.php

Leave a Reply

Your email address will not be published. Required fields are marked *