| Commit | Line | Data |
|---|---|---|
| 924dda1f | 1 | |
| 6ce212e4 | 2 | CREATE THE PostgreSQL DATABASE |
| 924dda1f DB |
3 | ------------------------------ |
| 4 | ||
| 6ce212e4 DB |
5 | Note that the database must be created with UTF-8 (Unicode) encoding. |
| 6 | ||
| 924dda1f | 7 | 1. CREATE DATABASE USER |
| b1b1e204 | 8 | |
| 25a4309e DB |
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: | |
| 924dda1f | 13 | |
| 1aec2983 | 14 | createuser --pwprompt --encrypted --no-createrole --no-createdb username |
| b1b1e204 | 15 | |
| 25a4309e | 16 | If there are no errors, then the command was successful. |
| 924dda1f | 17 | |
| 25a4309e | 18 | 2. CREATE DRUPAL DATABASE |
| b1b1e204 | 19 | |
| 25a4309e DB |
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': | |
| b1b1e204 | 24 | |
| 1aec2983 | 25 | createdb --encoding=UTF8 --owner=username databasename |
| b1b1e204 | 26 | |
| 25a4309e | 27 | If there are no errors, then the command was successful. |
| dde5c67b | 28 | |
| 25a4309e | 29 | 3. CREATE SCHEMA OR SCHEMAS (Optional advanced step) |
| dde5c67b | 30 | |
| 25a4309e DB |
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': | |
| dde5c67b | 40 | |
| 25a4309e | 41 | CREATE SCHEMA schema_name AUTHORIZATION username; |
| dde5c67b | 42 | |
| 25a4309e DB |
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. |