Home

26 August, 2005

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.

1 comments:

steve said...

sorry to drag this old post out of the wild, but i'm trying to debug a problem with my mediawiki installation.

I don't recall the installation process exactly, but I created a user "admin" and have been contributing content with that account.

Today I tried to access sysop pages, and it told me that I didn't have the required permission.

I then came across the same resource to edit the db directly, which I did - and discovered the permissions were already in place.

Last resort was to create a new account and manually apply sysop and bureaucrat permissions, and yet I still get the same error.

Any ideas?