Installing PostgreSQL on Windows
What is a Database?
A database is an organized collection of structured information, typically stored and accessed electronically from a computer system. It allows for efficient data storage, retrieval, and management and supports various operations like querying, updating, and data analytics.
What is PostgreSQL?
PostgreSQL is a powerful, open-source relational database management system (RDBMS) that has been widely adopted due to its advanced features, stability, and flexibility. PostgreSQL is a go-to solution for developers, data scientists, and data engineers who need a reliable database platform for managing everything from small applications to large-scale enterprise systems.
Installing PostgreSQL
1. Download PostgreSQL
Visit the official PostgreSQL (EnterpriseDB) website, and click the Windows download button.
2. Run the Installer
Once the download is complete, locate the setup file (typically in your Downloads folder) and run it.
A PostgreSQL Setup Wizard will popup, and then click Next.
3. Select Installation Directory
Choose the directory where you want to install PostgreSQL or leave it as the default location. Click Next.
4. Select Components
Keep the default options checked. Click Next.
5. Set Data Directory
Define the folder where PostgreSQL will store data. Click Next.
6. Set Password for PostgreSQL Superuser (postgres)
Choose a strong password for the superuser account. Click Next.
The postgres
user is the default administrative account for your PostgreSQL database. It has full access to all databases and can perform any operation, including creating new users and databases, modifying settings, and managing data. The password you set during this step will be used to verify the identity of the postgres
user when connecting to the server, whether through pgAdmin, a command-line interface, or a programming language like Python.
7. Set the Port Number
The default port is 5432. You can change it, but it’s fine to leave it as is.
8. Set the Advanced Options
Leave defaults as is unless there are specific needs.
Set the locale to be used by the new database cluster. This locale setting determines the language, region-specific formatting, and character classification rules for your database.
9. Review the Pre-Installation Summary
Verify the following settings that will be used for the installation.
10. Install
Click the Install button to begin the installation process.
After installation, you will be asked if you want to open the Stack Builder. The Stack Builder is an optional tool included in the PostgreSQL installer that allows you to download and install additional components and extensions for PostgreSQL. You may skip it.
11. Launch PostgreSQL
Type pgadmin
in the Windows Search. pgAdmin is the graphical user interface (GUI) for the administration and management tool for the PostgreSQL database.
Alternatively, type in psql
to launch the SQL Shell (psql), which is the command-line interface (CLI) for PostgreSQL.