How to promote Mediawiki user with sysop and bureaucrat privileges

The following lines will describe a procedure on how to promote mediawiki user to sysop and bureaucrat role directly using MySQL database.

Access database

First, connect to your database using mysql client. Depending on your environment you can run something like:

$ mysql -u USER -p PASSWORD

Once you get to the MySQL command prompt select appropriate Mediawiki database. In the example below the database name is wiki:

mysql> use wiki                                                                                                      
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

Obtain Mediawiki User ID

Run the below MySQL command to obtain a list of user names along with their relevant user IDs and take note of the user_id which belongs to a user you wish to upgrade with sysop and bureaucrat privileges:

mysql> SELECT user_id, CONVERT(user_name USING utf8) FROM `user`;
| user_id | CONVERT(user_name USING utf8) |
|       2 | JohnDet                       |
|       1 | TinaL                         |
|       4 | TroyRum                       |
|       3 | CretaLi                       |
4 rows in set (0.00 sec)

Assign Privileges

Lastly, alter user_groups MySql table to assign user eg. JohnDet with user_id: 2 to bureaucrat and sysop group:

mysql> INSERT INTO `user_groups` VALUES (2, 'sysop'),(2, 'bureaucrat');

Comments and Discussions
Linux Forum