How can I start PostgreSQL and pgAdmin III in windows without installation. I do not have admin rights in a system. so I need to start the application without installing . How can I do that?
The question is can you run a PostgreSQL server on your windows desktop/server box without having to install anything? The answer is yes and quite easily.
Please, please install your bundled PostgreSQL on a non-default port (not 5432) and if you run it as a service use a name associated with your application, so users know where it came from. See Installation of postgresql with NSIS . Put the PostgreSQL install directory within your app install directory. Thanks!
Download the ZIP file from https://www.enterprisedb.com/products-services-training/pgbindownload
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 subdirectory pgsql\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 as postgres
, -W
will prompt you for the password of the superuser, -E UTF8
will create the database with UTF-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 the bin
directory. Starting with Postgres 9.6 the pgAdmin executable pgAdmin4.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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With