Showing posts with label postgresqldba. Show all posts
Showing posts with label postgresqldba. Show all posts

How to install Postgresql Database in windows

 

Steps to install Postgresql Database in windows:

1.      Download PostgreSQL software from below link.

https://www.enterprisedb.com/download-postgresql-binaries

2.      A white background with black text

Description automatically generated with low confidence

Click on win x86-64, software will download.

3.      Extract that software, extracted binaries looks as below.

A black text on a white background

Description automatically generated with low confidence

4.      Copy this software to other drive from downloads.

5.      Create one directory as data to create database.

6.     

7.      Open a command prompt as administrator.

8.      Goto bin location of Postgresql software, copy that location go to that location from command prompt.

D:\postgresql\pgsql\bin

A black screen with white text

Description automatically generated with low confidence

9.      Goto data directory and copy that path, execute like below

10.  A picture containing text, screenshot, font

Description automatically generated

Initdb.exe -> is tool to create the database.

-D -> This option specifies the directory where the database cluster should be stored. 

-U -> Selects the user name of the superuser. This defaults to the name of the cluster owner.

 

Press enter, then it will create the database.

A screenshot of a computer program

Description automatically generated with medium confidence

11.  Create the service for postgresql database in windows.

Pg_ctl -> is too to initialize, start, stop, or control a PostgreSQL server

Register -> using for registering the service in windows

12.  Verify the service in services, Go to search box and run services.msc

13.  A screenshot of a computer

Description automatically generated with medium confidence

                                                                                                                                          

See the in services, postgresql service is created, to start the database click on start button .

Postgresql database is running now.

A screenshot of a computer

Description automatically generated with medium confidence

To connect the postgresql database open command prompt and run as like below.

A screenshot of a computer

Description automatically generated with medium confidence

Psql ->  PostgreSQL interactive terminal

-U -> Username with what user would like to connect the database.

To check the status of database

A picture containing text, font, screenshot

Description automatically generated

To stop the database from command prompt

A picture containing text, screenshot, font

Description automatically generated

To start the database from command prompt.

A picture containing text, screenshot, font

Description automatically generated

To connect the database.

A screen shot of a computer

Description automatically generated with low confidence

To Quite the database

A black screen with white text

Description automatically generated with low confidence

 

 

 

 

 

Connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


[postgres@srv data]$ psql -l
psql: could not connect to server: No such file or directory
              Is the server running locally and accepting
              Connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
That simple way is please update postgres home, bin, library details in  .bash_profile

[postgres@srv data]$cd 
[postgres@srv ~]$vi .bash_profile
if [ -f ~/.bashrc ]; then

. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export PG_HOME=/home/postgres/pgsql
export PATH=$PG_HOME/bin:$PATH:.
export PG_DATA=/home/postgres/data

save the details using esc, :wq

[postgres@srv ~]$. .bash_profile

hopefully this could resolve the issue.