Newer
Older

Dries Buytaert
committed

Dries Buytaert
committed
CREATE THE PostgreSQL DATABASE

Dries Buytaert
committed
------------------------------

Dries Buytaert
committed
Note that the database must be created with UTF-8 (Unicode) encoding.

Dries Buytaert
committed
1. CREATE DATABASE USER

Dries Buytaert
committed

Dries Buytaert
committed
This step is only necessary if you don't already have a user set up (e.g., by
your host), or want to create a new user for use with Drupal only. The
following command creates a new user named 'username' and asks for a password
for that user:

Dries Buytaert
committed

Dries Buytaert
committed
createuser --pwprompt --encrypted --no-createrole --no-createdb username

Dries Buytaert
committed

Dries Buytaert
committed
If there are no errors, then the command was successful.

Dries Buytaert
committed

Dries Buytaert
committed
2. CREATE DRUPAL DATABASE

Dries Buytaert
committed

Dries Buytaert
committed
This step is only necessary if you don't already have a database set up
(e.g., by your host) or want to create a new database for use with Drupal
only. The following command creates a new database named 'databasename',
which is owned by the previously created 'username':

Dries Buytaert
committed

Dries Buytaert
committed
createdb --encoding=UTF8 --owner=username databasename

Dries Buytaert
committed

Dries Buytaert
committed
If there are no errors, then the command was successful.

Dries Buytaert
committed
3. CREATE SCHEMA OR SCHEMAS (Optional advanced step)

Dries Buytaert
committed
Drupal will run across different schemas within your database if you so wish.
By default, Drupal runs inside the 'public' schema but you can use $db_prefix
inside settings.php to define a schema for Drupal to run inside of, or
specify tables that are shared inside of a separate schema. Drupal will not
create schemas for you. In fact, the user that Drupal runs as should not be
allowed to do this. You'll need to execute the SQL below as a superuser,
replace 'username' with the username that Drupal uses to connect to
PostgreSQL, and replace 'schema_name' with a schema name you wish to use,
such as 'shared':

Dries Buytaert
committed
CREATE SCHEMA schema_name AUTHORIZATION username;

Dries Buytaert
committed
Do this for as many schemas as you need. See default.settings.php for
instructions on how to set which tables use which schemas.