[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 Creating the database

To create a database, the PostgreSQL server must be up and running. Database is created with SQL command

 
CREATE DATABASE SQLTUTOR_DATABASE

Two database roles must be created for Sqltutor with SQL command CREATE ROLE

 
CREATE ROLE SQLTUTOR_WWW_USER LOGIN;
CREATE ROLE SQLTUTOR_WWW_EXEC LOGIN;

To set passwords for these new roles run psql and enter SQL ALTER command

 
ALTER USER SQLTUTOR_WWW_USER WITH PASSWORD 'xxx';
ALTER USER SQLTUTOR_WWW_EXEC WITH PASSWORD 'yyy';

or passwords can be set directly when creating roles

 
CREATE ROLE SQLTUTOR_WWW_USER PASSWORD 'xxx' LOGIN;
CREATE ROLE SQLTUTOR_WWW_EXEC PASSWORD 'yyy' LOGIN;

If PostgreSQL language is not defined in datatabase template1 you must create it explicitly in the Sqltutor database

 
su -
su - postgres
psql SQLTUTOR_DATABASE
CREATE LANGUAGE plpgsql;

This document was generated by Ales Cepek on January 18, 2018 using texi2html 1.82.