Skip to content

Instantly share code, notes, and snippets.

@sh1mu7
Last active September 17, 2023 18:24
Show Gist options
  • Save sh1mu7/55bbe7f8233e1db3e74a61954fd51797 to your computer and use it in GitHub Desktop.
Save sh1mu7/55bbe7f8233e1db3e74a61954fd51797 to your computer and use it in GitHub Desktop.
Postgres Configuration
######################## Installing Postgress ########################
sudo apt update
sudo apt install python3-venv python3-dev libpq-dev postgresql postgresql-contrib nginx curl
###################### Creating SuperUser ############################
CREATE ROLE user_name SUPERUSER LOGIN PASSWORD 'password';
or
CREATE USER user_name WITH PASSWORD 'password';
##################### Database creation and permission ############################
CREATE DATABASE database_name;
ALTER ROLE sh1mu7 SET client_encoding TO 'utf8';
ALTER ROLE sh1mu7 SET default_transaction_isolation TO 'read committed';
ALTER ROLE sh1mu7 SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE database_name TO user_name;
Grant postgress to username
select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where pg_stat_activity.datname = 'db_name';
@sh1mu7
Copy link
Author

sh1mu7 commented Sep 17, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment