MediaWiki Sysop User Account
It seems that I've managed to have yet another problem with my MediaWiki installation. After everything seemed to setup just fine, I tried to log into the system using the account that I had specified as a sysop account during setup.
Strangely enough, MediaWiki returned an error saying:
There is no user by the name ______
Hmm....that's funny. I guess the sysop account that I had specified during setup didn't 'take', or just wasn't added to the database. Oh well.
Rather than trying to attemp the setup process again, I decided to find an appropriate solution for the problem. First, I used my Wiki's create an account or login screen to add a user for myself. I used the same username and password that I had during the initial setup, and it didn't complain. I guess my sysop user really wasn't there.
Now that my account actually existed, I had to find a way to give it sysop and bureaucrat permissions in my Wiki. This, as I learned, can be most easily accomplished by editing the database directly, rather than monkeying around with MediaWiki's PHP code.
The table that must be modified is the user_rights table which should have been created by your MediaWiki setup (it was for me). This table contains the permissions applied to various usernames, and maps its user_id field to the user_id field in the user table. Thus, to edit some user permissions, all we have to do is find the appropriate user_id in the user table and then assign a new ur_rights value to this user_id in the user_rights table.
To discover what your user_id is you can use the following SQL query.
Select * from user
Then, just look for the user_idthat corresponds to the user (in my case, it was me) that you want to give sysop status to. Now you are prepared to run the following query. For our example, let's say that the user_id I wanted to change permissions for was 1. Here's what you do.
UPDATE user_rights SET ur_rights="bureaucrat,sysop" WHERE ur_user=1;
Presto! The user with user_id=1 has been made a sysop.
Strangely enough, MediaWiki returned an error saying:
There is no user by the name ______
Hmm....that's funny. I guess the sysop account that I had specified during setup didn't 'take', or just wasn't added to the database. Oh well.
Rather than trying to attemp the setup process again, I decided to find an appropriate solution for the problem. First, I used my Wiki's create an account or login screen to add a user for myself. I used the same username and password that I had during the initial setup, and it didn't complain. I guess my sysop user really wasn't there.
Now that my account actually existed, I had to find a way to give it sysop and bureaucrat permissions in my Wiki. This, as I learned, can be most easily accomplished by editing the database directly, rather than monkeying around with MediaWiki's PHP code.
The table that must be modified is the user_rights table which should have been created by your MediaWiki setup (it was for me). This table contains the permissions applied to various usernames, and maps its user_id field to the user_id field in the user table. Thus, to edit some user permissions, all we have to do is find the appropriate user_id in the user table and then assign a new ur_rights value to this user_id in the user_rights table.
To discover what your user_id is you can use the following SQL query.
Select * from user
Then, just look for the user_idthat corresponds to the user (in my case, it was me) that you want to give sysop status to. Now you are prepared to run the following query. For our example, let's say that the user_id I wanted to change permissions for was 1. Here's what you do.
UPDATE user_rights SET ur_rights="bureaucrat,sysop" WHERE ur_user=1;
Presto! The user with user_id=1 has been made a sysop.

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home