Install PostgreSQL
In this section you will learn how to install PostgreSQL.
It is recommended to perform the installation using the default values and options. Also, when prompted for a Windows admin password, you can use your Windows password.
- Open a command prompt in admin mode.
-
Launch the installer (postgresql-10.1-2-windows-x64.exe or later version) from
the command prompt.
Note: You should launch the installer from the command prompt only. This will auto-resolve the path to Windows native utilities needed for PostgreSQL to install and work correctly.
-
Launch the pgAdmin 4 tool (included with the installation), and add one user
with full rights:
-
Expand the Servers node until you have exposed
the Login/Group Roles node, as in the following image.
-
Right-click on Login/Group Roles and select Create > Login/Group Role... from the context menu.
The Login Role dialog box is displayed.
- On the General tab in the Name field, type hweuser.
- Click on the Definition tab, and in the Password field, type hwe_123.
-
Click on the Privileges tab and set all fields
to Yes.
-
Click the Save button.
Note: The connection limit should be set at 30.
-
Expand the Servers node until you have exposed
the Login/Group Roles node, as in the following image.
- Using Windows Explorer, locate the pg_hba.conf file and move it to the <PostGres_INSTALLATION_DIR>/data folder to replace the file already there.
- Open the Windows Task Manager, Services tab, and locate the postgresql-x64 service.
-
Restart the postgresql-x64 service by right-clicking on the service name and
selecting Restart from the context menu.
Note: This allows all users to connect without authentication.
- Reconnect to the server by clicking on the username, hweuser, and selecting Yes when prompted to reconnect.
- Optional:
If you need to locate the port number for the server connection, click on the
name of the server and then click the Properties
tab.
The Port number is listed under Connection, as displayed in the image above. Knowing the Port number allows you to share the connection with other users.