Total Pageviews

4505

Setting up PostgreSQL database using psql command-line tool in Windows/Linux

 Step - 1

Download and install a PostgreSQL. Refer to PostgreSQL documentation on www.postgresql.org.

During installation, set up a user account with superuser privileges.

[Linux]

Switch to postgres admin/super user

sudo su postgres

psql

[Window]

Add the PostgreSQL bin directory path to the PATH environmental variable.

To open the psql command-line tool. In the Windows Command Prompt, run the command.

C:\>psql -U postgres
Password for user postgres:

psql (13.4)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

postgres=#

postgres=# create database tetraloops;
CREATE DATABASE

postgres=# create user tetraloops with password 'tetraloops';
CREATE ROLE

postgres=# grant all privileges on database "tetraloops" to tetraloops;
GRANT

postgres=# exit

C:\>psql -U tetraloops
Password for user tetraloops:
psql (13.4)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.
tetraloops=>

If you’d like to display all tables that have already been created, you can use either the \d or \dt command to list them.

tetraloops=> \d
Did not find any relations.
tetraloops=>

OR

tetraloops=> \dt
Did not find any relations.
tetraloops=>

No comments:

Post a Comment

ORA-00845: MEMORY_TARGET not supported on this system

 The shared memory file system should have enough space to accommodate the MEMORY_TARGET and MEMORY_MAX_TARGET values. To verify: SQL> sh...