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 OverflowPostgreSQL
postgresql.org › docs › current › sql-createdatabase.html
PostgreSQL: Documentation: 18: CREATE DATABASE
May 14, 2026 - CREATE DATABASE creates a new PostgreSQL database.
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:
Videos
13:49
Installing and Creating Database in PostgreSQL - YouTube
10:05
Install PostgreSQL on Windows (Beginner Tutorial) | Create Your ...
32:52
How to Setup a Local PostgreSQL Database | Import Data, Create ...
06:28
How to Setup PostgreSQL and Create Database in PostgreSQL for ...
Top answer 1 of 11
394
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;
2 of 11
163
Try:
sudo -u postgres psql -c 'create database test;'
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....
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.
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