Roles, databases, and schemas

Create a PostgreSQL database

Create the application database with the non-login owner role and connect to it explicitly.

8 minute lesson

~~~

Create the database while connected as an administrator:

CREATE DATABASE notes_app OWNER notes_owner;

Then reconnect:

\connect notes_app

A PostgreSQL connection works inside one database. \connect closes the current connection and opens another one.

Confirm the result with \conninfo before creating schemas or tables.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →