Manual:Installation/Creating system accounts

Maybe the hardest part of the MediaWiki installation is to deal with users.

When installing the MediaWiki in the same server as your MySQL is hosted, there are 5 users involved in a such installation:


 * 1) wiki's SysOp - the administrator of the wiki. It only has access to the webinterfaces, so you'll never use it for shell commands.
 * 2) single host user - a normal user account on the server system.
 * 3) single database user - a normal user account on the mysql server.
 * 4) root host user - the superuser of the server system.
 * 5) mysql's root user - the superuser of the MySQL's entire database management.

The MediaWiki script installer http: //your_machine/wiki/config/ will require you to set the  wiki's SysOp account and provide either - a single database user (and its password); - or the MySQL's root user password.

You will need a wiki's SysOp account only when the MediaWiki is installed.

You need a single host user to some management that can't be done through the web (uncompress the MediaWiki distribution files, upgrade, change CSS files, etc).

You need root host access if:
 * You have no single database user;
 * You don't have the MySQL's root password;
 * You don't want/have permission to install php pages on your $HOME/public_html.

This article deals with users, so, we explain only the two former. We will explain how to create the single database user. Everywhere you see sudo you'll need the root host password. Elsewhere, you'll need to have the MySQL's root password.

Now logged with shell access to the MySQL machine server, as your single host user: mysqladmin -u root create wikidb -p Enter password: input your MySQL's root password, or, if you don't know, try enter to see if really there is a MySQL's root password set. If you type the wrong password, it'll appear: Access denied for user: 'root@localhost' (Using password: YES) (For those who don't remember the MySQL's root password, at the end of this section there is an explanation). Else, nothing will appear (or some errors that may overrun the scope of this documentation).

mysql -u root -p Enter password: input your MySQL's root password, or, if you don't know try enter. If you type the wrong password, it'll appear: Access denied for user: 'root@localhost' (Using password: YES) For those who don't remember the MySQL's root password, at the end of this section there is an explanation. Else: mysql> See if the database was really created by the mysqladmin: mysql> show databases; +--+ | Database | +--+ | mysql   | | test    | | wikidb  | +--+ 3 rows in set (0.00 sec)

Then: mysql> GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION ; mysql> GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION ; Exit : mysql> exit

Now, you can go to the installer script: http://your_machine/wiki/config/ and provide the wikiuser and the password you have set in the GRANT MySQL command. Don't provide any root password.

If you don't remember the MySQL's root password, you can add the option: skip-grant-tables to the region [mysqld] of your file /etc/my.cnf. It's suggested that, in this moment, you don't allow external connections to the mysql database, enabling this option on the same region [mysqld] of the same file /etc/my.cnf: skip-networking Because, when you restart the daemon, everyone will have root access to the mysql server (root access required to edit these files). It's also suggested that you don't allow any type of shell logins in this moment, such as ssh and rsh (for the same reason).

Restart the server. The command depends on your Linux distribution. For Fedora (2, but should work in every RedHat based distros): sudo /etc/init.d/mysqld restart Slackware (10.2, but should work in every Slackware based distros): sudo /etc/rc.d/rc.mysqld restart for opensuse 10 use sudo /etc/init.d/mysql restart

Now, you can follow the commands seen above:

mysqladmin -u root create wikidb -p mysql -u root -p

After that, don't forget to edit again the /etc/my.cnf and restart the server.