---
title: 3.3.2 Create User Accounts in PostgreSQL
description: "# Steps to Create i2b2 Database Users The following outlines the steps to take when creating the user accounts in your PostgreSQL database.   1. Log into PostgreSQL using psql.  $ su - postgres    $ psql 2. Create the…"
url: "https://i2b2.org/docs/3-3-2-create-user-accounts-in-postgresql/"
updated: "2026-09-15"
category: i2b2 Installation Guide / Chapter 3. Data Installation / 3.3 Create Database User Accounts
---

# 3.3.2 Create User Accounts in PostgreSQL

# Steps to Create i2b2 Database Users

The following outlines the steps to take when creating the user accounts in your PostgreSQL database.

 

1. Log into PostgreSQL using psql.

 $ su - postgres

 

 $ psql

2. Create the following databases:

| **Database** |
| --- |
| i2b2 |
|  |

**Example Command to create a database**

  **Create Database Command**

    Create database i2b2

3. Create the following users:

CREATE USER i2b2demodata WITH PASSWORD 'demouser' ;
CREATE USER i2b2hive WITH PASSWORD 'demouser' ;
CREATE USER i2b2imdata WITH PASSWORD 'demouser' ;
CREATE USER i2b2metadata WITH PASSWORD 'demouser' ;
CREATE USER i2b2pm WITH PASSWORD 'demouser' ;
CREATE USER i2b2workdata WITH PASSWORD 'demouser' ; 

Create the Schema's

CREATE SCHEMA i2b2demodata AUTHORIZATION i2b2demodata ;
CREATE SCHEMA i2b2hive AUTHORIZATION i2b2hive ;
CREATE SCHEMA i2b2imdata AUTHORIZATION i2b2imdata; 
CREATE SCHEMA i2b2metadata AUTHORIZATION i2b2metadata ;
CREATE SCHEMA i2b2pm AUTHORIZATION i2b2pm ;
CREATE SCHEMA i2b2workdata AUTHORIZATION i2b2workdata;

Important

Make sure you grant all privileges on all tables in the database to the appropriate user.

***Example:*** For the i2b2 database you will grant all access to the i2b2demodata user.

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2demodata;

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2hive;

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2imdata;

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2metadata;

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2pm;

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2workdata;

 GRANT ALL PRIVILEGES ON DATABASE i2b2 to i2b2demodata;
