11 C
Texas

How to install PostgreSQL on Windows 10.

Hi! Let’s talk about databases. Here we have already studied it. Likewise, we saw how to install MySQL on windows server 2019. It is an advanced, enterprise-class open-source relational database that supports both SQL (relational) and JSON (non-relational) querying. Besides, supports transactions, subselects, triggers, views, foreign key referential integrity, and sophisticated locking. It is multiplatform and supports text, images, sounds, and video. So in this post, we are going to see how to install and configure PostgreSQL in Windows 10.

Downloading PostgreSQL

In the first place, is to download the installer from the website. There you have to select the most recent version (11.5 at the time of writing this article) and download it.

PostgreSQL download
PostgreSQL download

Once you have downloaded the installer, double click on it to start the installation.

PostgreSQL wizard
PostgreSQL wizard

Next, the wizard will ask for the installation directory. By default, it will be installed on the “c” drive, but you can select any other destination directory. Click next to continue the installation.

Choose Installation Directory
Choose Installation Directory
- Advertisement -

In the next screen choose the components to install. By default, all are selected, I recommend you keep it like this.

Select the components to install
Select the components to install

Now choose the directory where the data will be stored.

Select director to store the data
Select director to store the data

Sets the password for the superuser of the PostgreSQL database.

Assign password for the database superuser
Assign password for the database superuser

Choose a port number. The default is 5432. In like manner, you can always configure the firewall to allow the connections.

Select the port number
Select the port number

Additionally, select the regional configuration to use.

Select the regional configuration
Select the regional configuration

On the next screen, check all installation options. If you are satisfied, click Next to continue.

Check installation options
Check installation options

Immediately, the installation process will begin.

Setup installing PostgreSQL
Setup installing PostgreSQL

Once the installation is complete, the wizard will ask if we want to launch the stack builder to download and install additional tools.

Installation Complete
Installation Complete

In the event that you’ve decided to launch the Stack Builder, it’ll start running. In addition, you need to be connected to the internet and select your server.

Stack Builder first run
Stack Builder first run

The application list will then be downloaded. Furthermore, select the additional configuration required and click Next to complete the installation.

Select the additional applications to install
Select the additional applications to install

Running and Configuring PostgreSQL

To start PostgreSQL, go to the start menu and select pgAdmin4.

Starting pgAdmin 4
Starting pgAdmin 4

You will then be prompted for the password you created at the time of the installation.

Set a master password
Set a master password

Then click on the Server tab and enter the password again. When we connect, we will see the database displayed.

Solving SQL database issue

When you click on the SQL tab, an error message will appear. This is because the command line has not been configured for SQL. With this in mind, go to the route where the database was installed. And copy the next path: C:\Program Files\PostgreSQL\11\bin

Copy the path where the program has been installed
Copy the path where the program has been installed

Now follow this path: Control Panel> System and Security>System> Advanced System Settings.

Control Panel> System and Security>System> Advanced System Settings.
Control Panel> System and Security>System> Advanced System Settings.

In the pop-up window there are a number of options, please select Environment Variables

Environment variables
Environment variables

Please locate the path line.

Path line into Environment variables
Path line into Environment variables

What we are going to do is create a new path, with this in mind click on Edit. Next, select New and paste the route you just copied. Press Ok to continue.

Adding new environment variable
Adding new environment variable

This same procedure must be repeated with the following path: C:\Program Files\PostgreSQL\11\lib

Adding a new environment variable
Adding a new environment variable

After you have set all the changes, press OK to accept. Additionally, open a Command Prompt and runs the following command:

 psql -U postgres postgres
CMD running psql
CMD running psql

You will be asked for your password, please enter it to access the database. Then reload the browser, click on the SQL tab and the connection to the database will be established.

pgAdmin 4 running SQL database
pgAdmin 4 running SQL database

Conclusion

Finally, we have learned how to install and configure PostgreSQL on Windows 10. It’s a long process, but it is worth a try to work with this database. Please visit our post about PowerToys in Windows 10. To keep up to date with updates on Windows 10, join our telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article