root/1.8.3/branches/autoconf/README.SQL

Revision 742, 7.0 KB (checked in by shawnw, 21 months ago)

autoconf: #7258: sqlite3 support

Line 
1
2                            Use SQL with PennMUSH
3                             Revised: 24 May 2004
4
5
6As of version 1.7.7p32, PennMUSH includes functions and commands that
7can access SQL databases. Currently, the following databases are
8supported:
9
10  * MySQL
11  * PostgresQL (from 1.8.3p2)
12  * Sqlite v3  (from 1.8.3p2)
13
14This document explains how to use (or avoid) SQL with PennMUSH, and covers
15the following issues:
16
17   I. Compiling with or without SQL
18   II. Mush configuration overview
19   III. SQL setup tips
20
21I. Compiling with/without SQL
22
23In general, Configure attempts to detect all support sql client
24libraries on the host, and will link with all of them, permitting
25you to select which platform you want at runtime. You can selectively
26prevent linking with client libraries that are present on your
27system, as well; this is described below.
28
29I.a. MySQL
30
31  The configure script distributed with PennMUSH automatically detects
32  the MySQL client library via the presence of the mysql_config program,
33  which will tell configure where needed headers and libraries are.
34
35  If you want to avoid linking these libraries on systems where they
36  are present, pass the --without-mysql switch to configure.
37
38  If you installed Mysql from a binary package (e.g. rpm or apt),
39  you should be sure that your system also has the development
40  package (usuallyl mysql-dev or mysql-devel).
41
42  If you think you have mysql libraries and header files but configure
43  isn't finding them, they may be in an unusual location on your system,
44  with mysql_config not in your default path.
45  Find its location ('where mysql_config' if the program works for you,
46  'find / -name mysql_config' otherwise, and call configure with
47  --with-mysql=/path/to/mysql_config
48
49I.b. PostgresQL
50
51  The configure script distributed with PennMUSH automatically detects
52  the PostgresQL client library via the pg_conf program, which will
53  tell configure where needed headers and libraries are.
54
55  If you want to avoid linking these libraries on systems where they
56  are present, pass the --without-postgresql switch to configure.
57
58  If you installed PostgresQL from a binary package (e.g. rpm or apt),
59  you should be sure that your system also has the development
60  package (usually postgresql-dev, or libpq or similar)
61
62  If you think you have postgresql libraries and header files but configure
63  isn't finding them, they may be in an unusual location on your system,
64  with pg_config not in your default path.
65  Find its location ('where pg_config' if the program works for you,
66  'find / -name pg_config' otherwise, and call configure with
67  --with-postgresql=/path/to/pg_config
68
69I.c Sqlite
70
71  The configure script distrubted with PennMUSH looks for sqlite3 headers
72  and libraries in /usr, /usr/local and /opt. If it's somewhere else on
73  your system, call configure with --with-sqlite3=/path/to/sqlite3
74
75  The path is the directory that contains the hdrs/ and lib/ directories
76  that hold the sqlite3 headers and library respectively.
77
78II. Mush configuration overview
79
80  mush.cnf includes these directives that configure the SQL support:
81
82  sql_platform provides the name of the SQL database server software
83  that will be used for connections. It current takes one of four
84  values: "disabled" (no SQL), "mysql", "postgresql", or "sqlite3".
85  If not specified, it defaults to disabled.
86
87  sql_host gives the name of the host running the SQL server.
88  It defaults to 127.0.0.1, which makes a TCP connection to the
89  local host. The keyword "localhost" instead makes a domain socket
90  (Unix) or named pipe (Windows) connection under MySQL.
91  You can also specify an alternate port by setting sql_host to
92  hostname:port (e.g. 127.0.0.1:5444).
93
94  sql_database gives the name of the database that contains the
95  MUSH's tables. This must be specified and there is no default.
96 
97  sql_username provides a username to connect to the SQL server
98  with. If no specified, a null username will be used, which many
99  SQL servers treat as "the user running this (pennmush) process".
100
101  sql_password provides the password for the user. It defaults to
102  no password.
103 
104  For sqlite3, which uses a local file instead of connected to a database
105  server, sql_database gives the name of the database file, sql_host must
106  be localhost, and the username and password are currently ignored.
107
108III. SQL setup tips
109
110  You will have to set up the appropriate database on the SQL server,
111  and username permitted to perform operations in that database,
112  and a password for that username. This is a platform-specific process.
113
114  A. MySQL platform
115
116    Easiest way is:
117
118    % mysql_setpermission --user root           REQUIRED
119          --host <mysql host> --port <mysql port>   OPTIONAL, OR:
120          --socket <unix domain socket>         OPTIONAL
121
122    ######################################################################
123    ## Welcome to the permission setter 1.2 for MySQL.
124    ## made by Luuk de Boer
125    ######################################################################
126    What would you like to do:
127      1. Set password for a user.
128      2. Add a database + user privilege for that database.
129         - user can do all except all admin functions
130      3. Add user privilege for an existing database.
131         - user can do all except all admin functions
132      4. Add user privilege for an existing database.
133         - user can do all except all admin functions + no create/drop
134      5. Add user privilege for an existing database.
135         - user can do only selects (no update/delete/insert etc.)
136      0. exit this program
137   
138    Make your choice [1,2,3,4,5,0]: 2                    <==========
139
140    Which database would you like to add: mush
141    The new database mush will be created
142   
143    What username is to be created: mush                 <==========
144    Username = mush
145    Would you like to set a password for  [y/n]: y       <==========
146    What password do you want to specify for :           <==========
147    Type the password again:                             <==========
148    We now need to know from what host(s) the user will connect.
149    Keep in mind that % means 'from any host' ...
150    The host please: localhost                           <==========
151    Would you like to add another host [yes/no]: no      <==========
152    Okay we keep it with this ...
153    The following host(s) will be used: localhost.
154    ######################################################################
155   
156    That was it ... here is an overview of what you gave to me:
157    The database name       : mush
158    The username            : mush
159    The host(s)             : localhost
160    ######################################################################
161   
162    Are you pretty sure you would like to implement this [yes/no]: yes
163
164  B. PostgresQL
165
166    As the postgres user:
167
168    % createuser -A -d -P mush
169    Enter password for new user:            <===========
170    CREATE USER
171
172    % createdb -U mush mush
173    Password:                   <===========
174    CREATE DATABASE
175
176  C. Sqlite3:
177   
178    As the same user account that runs the mush:
179       % cd pennmush/game/data
180       % sqlite3 mush.db
181         > create table ....
Note: See TracBrowser for help on using the browser.