How To Install PostgreSQL On Windows 10

Jimmy McBride - Apr 25 '20 - - Dev Community

And Use It From Your Terminal

Installation Instructions

Go to PostgreSQL Database Download and download the version of PostgreSQL you want under the "Windows x86-64" column. Once the installer is done downloading, run that bad boy.

Download PostgreSQL

Once you run the installer you downloaded, you should see a screen that looks like this:

PostgreSQL installer

Click Next >. Then choose your installation directory:

Alt Text

Select components. I would leave all these checked and click Next >.

PostgreSQL components

Select the data directory. I left its default value.

PostgreSQL data directory

Set up a password for your PostgreSQL user. Do something that's really easy to remember. If you're not worried about somebody hacking and finding sensitive data in your local PostgreSQL data, you would probably be fine setting it to password.

PostgreSQL password

Set up PostgreSQL port. Default is 5432, I recommend leaving it like that.

PostgreSQL port

Choose your locale. I speak English and I'm from the United States, so I choose English, United States.

PostgreSQL locale

Once we get to the pre-installation, click Next >.

PostgreSQL pre-installation

Then click Next > again and it install will start!

Install PostgreSQL

Now, in your Windows search bar, type: Edit the system environment variables. Click on that and you should see this:

Windows env vars

Then click on the Environment Variables button.

User env vars

Click on PATH under user variables and then Edit... and then add the path to your PostgreSQL's bin folder to the list of locations in your PATH variable.

PostgreSQL path

Click OK then OK and OK again. Once you've closed out of everything you should open up your terminal and type psql -U postgres and it will ask you for PostgreSQL's password. Whatever you set it as during the installer will be what you want to type in, and tada! 🎉 You can now use PostgreSQL in the terminal now!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .