starting postgresql and pgadmin in windows without installation
Thank you. This worked for me. But, i was getting error while starting psql.exe
The error was "psql: FATAL : role [user] does not exist."
To resolve this, i followed the below steps:
- Be on the same folder path (where you have initdb.exe) i.e. source-folder/pgsql/bin
- Run "psql -U postgres". This will ask for password.
- Now enter the password that was set during postgres intialization. This will open the psql command prompt.
Hope this helps.. :)
I tried above method its working fine, but when i tried to connect it via JDBC i used to get
"The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver."
This happens because scram-sha-256 has some issue(refer here), i couldn't understand in depth, so i changed it to md5, All started to work smoothly.hope it helps
.\initdb -D D:\database\dbdata -U postgres -W -E UTF8 -A md5
Download the ZIP file from https://www.enterprisedb.com/download-postgresql-binaries
Unzip the archive into a directory of your choice (the archive is created such that unzipping it, it will create a directory
pgsql
with everything else below that)Run
initdb
(this can be found in the subdirectorypgsql\bin
)initdb -D c:\Users\Arthur\pgdata -U postgres -W -E UTF8 -A scram-sha-256
This will create the postgres "data directory" (aka the "cluster") in
c:\Users\Arthur\pgdata
. You need to make sure that the user running this command has full read/write privileges on that directory.-U postgres
creates the superuser aspostgres
,-W
will prompt you for the password of the superuser,-E UTF8
will create the database withUTF-8
encoding and-A scram-sha-256
enables the password authentication.To start Postgres, run:
pg_ctl -D c:\Users\Arthur\pgdata -l logfile start
this has(!) to be done as the user who ran
initdb
to avoid any problems with the access to the data directory.To shutdown Postgres, run:
pg_ctl -D c:\Users\Arthur\pgdata stop
psql.exe
(the command line client) is located in thebin
directory. Starting with Postgres 9.6 the pgAdmin executablepgAdmin4.exe
is located in the sub-directory"pgAdmin 4\bin"
.Optionally create a Windows service to automatically run Postgres (must be run using a Windows administrator account)
pg_ctl register -N postgresql -D c:\Users\Arthur\pgdata