Install

src: https://community.chocolatey.org/packages/postgresql

Как выбрать параметры установки -- см. ссылку выше

choco search psql # select version
choco install postgresql17
# !! the password will autogenerate if not selected

Setup

deafult user: postgres
password -- see above, default: postgres, or:

To log in without a password:

sudo -u user_name psql db_name

To reset the password if you have forgotten:

ALTER USER user_name WITH PASSWORD 'new_password'; # meow

![[Pasted image 20241105184213.png]]

Create DB

For linux:

su - postgres

For windows: use -U option

Create User for Postgres (in the shell and NOT with psql)

$ createuser testuser

Create Database (same)

$ createdb testdb

Acces the postgres Shell

psql ( enter the password for postgressql)

Provide the privileges to the postgres user

$ alter user testuser with encrypted password 'qwerty';
$ grant all privileges on database testdb to testuser;

Load Dump

Linux

psql --username=<db_user_name> databasename < data_base_dump

Windows

use -f instead of <