From The Mana World
Revision as of 21:29, 16 September 2008 by Exceptionfault (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is currently WIP and should describe how to set up the database for a new installation of tmwserv. This page should be moved to Setting up a server when finished.


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 mySQL

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 tmwserv running under mySQL would be the creation of a database and a user. As you can easily do this with graphical frontends like phpMyAdmin, we will give you a handy script. Don't forget to replace the placeholders with appropriate values. For the following commands you have to be logged in as a database administrator, preferable root.

-- create a user called tmw (modify this as you whish)
-- the 'localhost' says, that our new user is only allowed from our local machine
CREATE USER 'tmw'@'localhost' IDENTIFIED BY '<insert your password preferred here>';
-- allow the user to connect to the server without any resource limitations
GRANT USAGE ON * . * TO 'tmw'@'localhost' IDENTIFIED BY '<again your pwd>' 
   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 'tmw' but you can name it just as you like
CREATE DATABASE IF NOT EXISTS `tmw` ;
-- give our new user full privileges on our new created database
GRANT ALL PRIVILEGES ON `tmw` . * TO 'tmw'@'localhost';
   

Summarized: now we have a new database called tmw, a new database user tmw that has full rights in this database, and a restriction, that he 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 tmwserv provides you with a ready to use database script. You can find this script under ./src/sql/mysql/createTables.sql To run this script connect as user tmw with your database.

mysql --host localhost --user tmw --password --database tmw --no-beep

After typing your password you should be connected to the database. The command \. runs a database script.

\. <path to the script>/createTables.sql
-- e.g.
\. ~/tmwserv/src/sql/mysql/createTables.sql


Settings up SQLite

Settings up PostgreSQL