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>;

This article is originally created by tooli.top. Please indicate the source when reprinting : https://www.tooli.top/posts/pgsql_superuser

Posted on 2023-03-07 Mail to author