How create database and switch database in SQL Shell of PostgreSQL 9.6?
In last post I show how install and create first database of PostgreSQL
in pgAdmin
. In this section I show how connect to PostgreSQL database , create new database and connect to new database.
First run SQL Shell
.
You see server default name, you can write new name if it is different as default. Click the Enter
.
You see default database name, may write new name if it is different as default. Click the Enter
.
As in server and database, you may leave default port to connect. Click the Enter.
If the user is postgres(it is default user), click the Enter
.
You will be invite to write password.
Write your password and click the Enter
.
You are in postgres – main database. Write command:create database nameOfDatabase
It query create new database.
The database was created. To connect to new database, you can write command:\c
or \connect
with name of new database. Look at screen below.