====== Database installation ====== Before you can set up your own server you have to decide wich database backend you want to use. Currently, the server supports three different types of database backends: * mySQL * SQLite * PostgreSQL ==== Settings up SQLite (Default database) ==== === Requirements === So far, the Mana Server has been tested with SQLite version 3.6.23.1 === Preparation of database file === The creation of a new database file is very easy. Just go to the directory where you want to create it and type: sqlite3 mana.db < ${ManaServ-dir}/src/sql/sqlite/createTables.sql This will create the ''mana.db'' file and execute the SQL statements in ''createTables.sql''. To verify if the installation was successful, you could do in a shell prompt: $ sqlite3 mana.db sqlite> .tables This should give you a list of mana_* tables. === Configuring ManaServ to use the database === Before starting ManaServ, you'll have to configure the account server where your database file is located. \\ The ManaServ engines use a XML file called ''[[manaserv.xml]]'' with an easy to read //key = value// structure. Locate the option ''sqlite_database'' and modify the value attribute according to your environment. You can use a relative path starting at the location of your ManaServ executable. ==== Settings up MySQL ==== === Requirements === To run ManaServ with MySQL you should use a MySQL version >= 5.0.*. It was tested successfully with 5.0.51a. \\ Also you have to enable the [[http://dev.mysql.com/doc/refman/5.0/en/innodb.html|InnoDB]] storage engine as ManaServ makes use of the relational and transactional features. \\ **Note:** You need to compile ManaServ with MySQL support to be able to use MySQL: See [[compile_manaserv_from_source|Compilation of the ManaServ server]] for more information === Creating a database and a user === This chapter assumes, that you still have little experience working with mysql, so it does not describe how to install MySQL itself. \\ The first step to get ManaServ running under MySQL would be the creation of a database and a user. As you can easily do this with graphical frontends like [[http://www.phpmyadmin.net|phpMyAdmin]], we will give you a handy script for doing that from command line. \\ Don't forget to replace the placeholders with appropriate values for your environment. For the following commands you have to be logged in as a database administrator, preferably ''root''. * Create a system user used for the ManaServ connection, manasys for instance. \\ The MySQL server should say that our new user is only allowed from our local machine: CREATE USER 'manasys'@'localhost' IDENTIFIED BY ''; * Allow the user to connect to the server without any resource limitations, in that case: \\ (You may want to review the allowed resources on your own.) GRANT USAGE ON * . * TO 'manasys'@'localhost' IDENTIFIED BY '' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; * Create a new database called 'mana', for instance: CREATE DATABASE IF NOT EXISTS `mana`; * Give our new user full privileges on our new created database: GRANT ALL PRIVILEGES ON `mana` . * TO 'manasys'@'localhost'; In short, we have now a new database called ''mana'', a new database user ''manasys'' that has full rights in its database, and the restriction that it is only able to connect from localhost. === Create database tables === If our new database user is ready for use, we have to create all necessary tables. The installation of ManaServ is providing you a ready to use database script. You can find this script in the following folder: ''./src/sql/mysql/createTables.sql'' \\ To run this script connect as user manasys to your database from a shell prompt, fro instance: mysql --host=localhost --user=manasys --password= --database= After typing your password you should be connected to the database. The command ''\.'' runs a database script: \. /createTables.sql -- e.g. \. ~/manaserv/src/sql/mysql/createTables.sql === Configuring ManaServ to use the database === The following options need to be set in your [[manaserv.xml]] (change them to your actual used settings):