DEV Community

Cover image for How To Access PostgreSQL Globally in Windows
Emmanuel Larbi
Emmanuel Larbi

Posted on

How To Access PostgreSQL Globally in Windows

If you are getting the error below after installing PostgreSQL don’t panic, just follow along with this tutorial and it’s gonna be solved.

Header image

This tutorial is simplified to help everyone to know how to add PostgreSQL to user or system variable(path) which can be accessed globally with minimum stress.

Let’s begin!

Normally, you will have to navigate to your PostgreSQL bin directory to copy the path which takes a while. Instead, I will provide the path for you to make everything quick and easy.

Path to postgresql bin directory —

C:\Program Files\PostgreSQL\14\bin
Enter fullscreen mode Exit fullscreen mode

NB: Change \14\ to the version of Postgres you have installed

Step 1

Copy the path to your Postgres bin directory provided above.

Step 2

Press the windows start button and search for env then click open

Search

Step 3

Click on Environment Variables

env

Step 4

Double click on Path

Path

Step 5

Click on New

Paste path

Step 6

Paste the [PostgreSQL bin](C:\Program Files\PostgreSQL\14\bin) path you copied. Then click ok recursively to close all windows

Paste path

Step 7

Close all instances of your terminal then reopen it.

NB: If you are using terminals in VS Code Editor, you will have to restart VS Code Editor for the changes to take effect

Postgres Accessed Globally

Step 8

You are done

And now you can log in to Postgres without using the default psql shell.

Hope this solves your issue about using Postgres globally.

Thank You

Top comments (0)