Create a PostgreSQL superuser and its own database (using CLI or SQL)

Create a PostgreSQL superuser and its own database with CLI

createuser -s -P <username> # the CLI will ask you to enter the password
createdb -O <username>  <dbname>

Please replace names like <username> and <dbname> with your own names.

Create a PostgreSQL superuser and its own database with SQL

CREATE USER <username> WITH PASSWORD '<password>' SUPERUSER;
CREATE DATABASE <dbname> OWNER <username>;
Posted on 2023-03-07