1
|
|
2
|
CREATE THE PostgreSQL DATABASE
|
3
|
------------------------------
|
4
|
|
5
|
Note that the database must be created with UTF-8 (Unicode) encoding.
|
6
|
|
7
|
1. CREATE DATABASE USER
|
8
|
|
9
|
This step is only necessary if you don't already have a user set up (e.g., by
|
10
|
your host), or want to create a new user for use with Drupal only. The
|
11
|
following command creates a new user named 'username' and asks for a password
|
12
|
for that user:
|
13
|
|
14
|
createuser --pwprompt --encrypted --no-createrole --no-createdb username
|
15
|
|
16
|
If there are no errors, then the command was successful.
|
17
|
|
18
|
2. CREATE DRUPAL DATABASE
|
19
|
|
20
|
This step is only necessary if you don't already have a database set up
|
21
|
(e.g., by your host) or want to create a new database for use with Drupal
|
22
|
only. The following command creates a new database named 'databasename',
|
23
|
which is owned by the previously created 'username':
|
24
|
|
25
|
createdb --encoding=UTF8 --owner=username databasename
|
26
|
|
27
|
If there are no errors, then the command was successful.
|
28
|
|
29
|
3. CREATE SCHEMA OR SCHEMAS (Optional advanced step)
|
30
|
|
31
|
Drupal will run across different schemas within your database if you so wish.
|
32
|
By default, Drupal runs inside the 'public' schema but you can use $db_prefix
|
33
|
inside settings.php to define a schema for Drupal to run inside of, or
|
34
|
specify tables that are shared inside of a separate schema. Drupal will not
|
35
|
create schemas for you. In fact, the user that Drupal runs as should not be
|
36
|
allowed to do this. You'll need to execute the SQL below as a superuser,
|
37
|
replace 'username' with the username that Drupal uses to connect to
|
38
|
PostgreSQL, and replace 'schema_name' with a schema name you wish to use,
|
39
|
such as 'shared':
|
40
|
|
41
|
CREATE SCHEMA schema_name AUTHORIZATION username;
|
42
|
|
43
|
Do this for as many schemas as you need. See default.settings.php for
|
44
|
instructions on how to set which tables use which schemas.
|