Promoting a user to sysop when all sysops are gone on a MediaWiki installation
Working for a client who has documentation on a MediaWiki installation which was set up before we got there. Was able to create users for ourselves through the regular site, but certain things like deleting pages can only be done by sysops. None of our newly registered users are of course sysops and the only existing sysop user is from whoever installed the wiki to begin with.
Here's how to promote a user to sysop the hackish way, directly in the database.
Find database details
- SSH into the system where MediaWiki is installed and find its location. It was
/var/www/html/foowikiin our case.
LocalSettings.phpand everything should be under the heading
## Database settings
📝 This can of course be skipped if you already know how to access your mediawiki database, but I didn't. 🙂
- Connect with a mysql client.
mysql -h localhost -u wikiuser -p wikidb
- Find the user id.
select user_id, convert(user_name using utf8) from `user`;
- Add user id to sysop (and bureaucrat) group.
insert into `user_groups` values (uid, 'sysop'),(uid, 'bureaucrat');
The user should now be sysop, which can be double checked on the
Special:ListUsers wiki page.