Change the user to postgres :

su - postgres

Create User for Postgres (in the shell and NOT with psql)

$ createuser testuser

Create Database (same)

$ createdb testdb

Acces the postgres Shell

psql ( enter the password for postgressql)

Provide the privileges to the postgres user

$ alter user testuser with encrypted password 'qwerty';
$ grant all privileges on database testdb to testuser;
Answer from django-renjith on Stack Overflow
🌐
PostgreSQL
postgresql.org › docs › current › tutorial-createdb.html
PostgreSQL: Documentation: 18: 1.3. Creating a Database
May 14, 2026 - A running PostgreSQL server can manage many databases. Typically, a separate database is used for each project or for each user. Possibly, your site administrator has already created a database for your use. In that case you can omit this step and skip ahead to the next section. To create a new database from the command line, in this example named mydb, you use the following command:
🌐
Neon
neon.com › postgresql › administration › create-database
PostgreSQL CREATE DATABASE Statement
In PostgreSQL, a database is a collection of related data, which serves as a container for tables, indexes, views, and other database objects. To create a new database, you use the CREATE DATABASE statement.
🌐
DB Vis
dbvis.com › thetable › create-database-in-postgresql-a-complete-guide
CREATE DATABASE in PostgreSQL: A Complete Guide
April 30, 2025 - Download DbVisualizer for free, connect to your PostgreSQL server, and navigate to the “Databases” tab on the right: ... Here, you can create a new database by simply filling out the form and clicking the "Execute" button:
🌐
TutorialsPoint
tutorialspoint.com › postgresql › postgresql_create_database.htm
PostgreSQL - CREATE Database
By default, the new database will be created by cloning the standard system database template1. The basic syntax of CREATE DATABASE statement is as follows − · CREATE DATABASE dbname; where dbname is the name of a database to create.
🌐
PostgreSQL
postgresql.org › docs › current › manage-ag-createdb.html
PostgreSQL: Documentation: 18: 22.2. Creating a Database
May 14, 2026 - In order to create a database, the PostgreSQL server must be up and running (see Section 18.3). Databases are created with the SQL command CREATE DATABASE: ... where name follows the usual rules for SQL identifiers.
🌐
Micro Focus
microfocus.com › documentation › idol › IDOL_12_0 › MediaServer › Guides › html › English › Content › Getting_Started › Configure › _TRN_Set_up_PostgreSQL.htm
Set Up a PostgreSQL Database on Windows - Micro Focus
This step enables you to use the ... file path in the Command Prompt to start psql. ... Enter your password when prompted. Run a CREATE DATABASE command to create a new database....
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › postgresql › postgresql-create-database
PostgreSQL - Create Database - GeeksforGeeks
July 12, 2025 - The PSQL provides a command-line interface to create a database using the CREATE DATABASE SQL command. This method allows us to define specific parameters such as owner, template, and tablespace to customize your database.
🌐
Tutorial Teacher
tutorialsteacher.com › postgresql › create-database
Create Database in PostgreSQL using psql and pgAdmin
PostgreSQL database can be created using psql (SQL Shell) and pgAdmin. Use the CREATE DATABASE command in psql to create a new database in PostgreSQL.
🌐
StrongDM
strongdm.com › blog › security
Create a Database in PostgreSQL (Step-By-Step Guide)
January 7, 2025 - On your PostgreSQL server’s dashboard, right-click the “Databases” menu. ... In the dialog that appears, enter your preferred database name and fill in the rest of the settings. Click “Save” to create the new database.
🌐
Guru99
guru99.com › home › postgresql › how to create database in postgresql
PostgreSQL/Postgres Create Database
2 weeks ago - The syntax to create a database in PostgreSQL is CREATE DATABASE databasename
🌐
GeeksforGeeks
geeksforgeeks.org › postgresql › create-database-postgresql
Create Database in PostgreSQL - GeeksforGeeks
1 month ago - In the Object Explorer, right-click Databases and select Create → Database. Navigate to the Databases Menu · In the New Database dialog, enter the new database name, owner and configure other parameters.
🌐
Cherry Servers
cherryservers.com › home › blog › postgresql › how to create a database in postgresql [create database, createdb]
How to create a database in PostgreSQL | Cherry Servers
November 7, 2025 - This step-by-step tutorial demonstrates how to create a database in PostgreSQL, using CREATE DATABASE or createdb command.
🌐
DevArt
blog.devart.com › home › how to › how to create a new database in postgresql
How to create a new database in PostgreSQL?
July 7, 2025 - In this article, we are going to describe different ways to create a PostgreSQL database from scratch. Here, you will find a tutorial for setting up a database using the CREATE DATABASE command in the command line, the pgAdmin platform, and dbForge Studio for PostgreSQL.
🌐
Prisma
prisma.io › dataguide › postgresql › create-and-delete-databases-and-tables
Create and Delete Databases and Tables in PostgreSQL | PSQL CreateDB
The basic syntax for the createdb command (which should be run by a system user with admin access to PostgreSQL) is: ... This will create a database called db_name within PostgreSQL using the default settings.
🌐
DataCamp
datacamp.com › doc › postgresql › create-database
PostgreSQL CREATE DATABASE
This example creates a new database named my_database using the default settings. This is suitable for quick setups or testing purposes. CREATE DATABASE sales_db WITH OWNER = sales_admin;
🌐
PostgreSQL
postgresql.org › docs › current › app-createdb.html
PostgreSQL: Documentation: 18: createdb
May 14, 2026 - Specifies the name of the database to be created. The name must be unique among all PostgreSQL databases in this cluster. The default is to create a database with the same name as the current system user.
🌐
YouTube
youtube.com › bek brace
PostgreSQL (1) Installation and Create Your First Database ( SQL shell / PgAdmin4 ) - YouTube
In this video we are going to learn about a new database management system called PostgreSQL.PostgreSQL is an advanced, enterprise-class and open source obje...
Published   October 24, 2020
Views   103K