PostgreSQL - Installing PostgreSQL Without Admin Rights on Windows
For developers working in corporate environments, admin privileges to install software might be restricted. But if we’re looking to explore PostgreSQL on our own, here’s a step-by-step guide on installing PostgreSQL without admin rights on a Windows system. Follow this guide to set up PostgreSQL manually, create a database, and verify the installation without requiring administrative permissions.
Installing PostgreSQL Without Admin Rights on Windows
This section covers the entire process of manually setting up PostgreSQL, from downloading binaries to configuring our environment for easy access. By following these steps, you’ll have PostgreSQL running on your system, enabling us to work with databases seamlessly without admin access.
Step 1: Download PostgreSQL Binaries
To begin, we’ll need the PostgreSQL binary files rather than the standard installer:
- Visit the official PostgreSQL binaries download page.
- Choose and download the version you want in ZIP format (e.g., PostgreSQL 13).
- Save the downloaded file in a location where you have full access, such as
D:\PostgreSQL
.
Step 2: Extract and Organize the Files
After downloading, follow these steps to organize PostgreSQL on your system:
- Create a new folder (e.g.,
D:\PostgreSQL\pgsql
) to serve as your PostgreSQL directory. - Extract the ZIP file into this folder. Your directory should look like this after extraction:

Step 3: Set Environment Variables for PostgreSQL
Adding PostgreSQL to your Environment Variables allows you to run PostgreSQL commands from any command prompt window:
- Go to System Properties > Advanced System Settings.
- Under Environment Variables, find the Path variable in your user section and add the path to the PostgreSQL
bin
directory, such asD:\PostgreSQL\pgsql\bin
.

Well, Congratulations!!. At this point, we have successfully configured PostgreSQL in your windows system.
Step 4: Verify the Installation
To verify if it is installed properly, use the following commands. Hence, the below command checks the PostgreSQL server version:
postgres -V

The below command checks the PostgreSQL client version:
psql -V

Step 5: Initialize the Database
Now it is time to initialize the database and associate a user to this. The database will be initialized at the location given by us (data folder in this case). The command for this is as follows:
initdb -D D:\PostgreSQL\pgsql\data -U postgres -E utf8
Explanation of flags:
- --D path/to/db/server/: Specifies the directory where PostgreSQL data files are stored.
- -U name: Creates a superuser with the specified name.
- -W: Prompts for a password for the superuser.
- -E encoding: Sets the character encoding for the database (e.g., utf8).
- -A: Encrypts the superuser’s password for added security.

Step 6: Start the PostgreSQL Server
Start the database by running the following command. This command starts PostgreSQL and logs its activities in a logfile
.
pg_ctl -D D:\PostgreSQL\pgsql\data -l logfile start

Step 7: Configure pgAdmin for Database Management
- Now navigate to the location of your PostgreSQL binary folder and traverse to the following path as shown in the figure.

- Double click on pgAdmin4 application. Now a pgAdmin4 instance will load into the system's default browser.

- Set a master password to secure the server.
- Now click on Servers on the right-hand side to create a new server for your database. Fill in the required details.
Step 8: Creating a Database
Once our server is running, we can create a new database using either psql
or pgAdmin. Click on the Database section to create a new database for our work purpose and begin using it. Here’s the command to create a sample database named school
.
CREATE DATABASE school;
Step 9: Stopping the PostgreSQL Server
To stop the database, use the same command used for start database as used in Step 8 and replace start by stop.
pg_ctl -D D:\PostgreSQL\pgsql\data -l logfile stop
Setting Up Binary Paths for Advanced Utilities
To access advanced utilities in pgAdmin like backup, restore, and upgrade, set up the binary paths:
- In pgAdmin, go to File > Preferences.
- Navigate to Paths > Binary Paths and add your PostgreSQL
bin
path (e.g.,D:\PostgreSQL\pgsql\bin
).

Conclusion
With this guide, we can now install PostgreSQL on Windows without admin rights and have complete control over the database environment. By following these steps, we’ll be able to fully use PostgreSQL, create and manage databases, and work with pgAdmin4 without needing administrator permissions on our machine. This setup allows developers to explore PostgreSQL's powerful capabilities in restricted environments, maximizing productivity and flexibility.