Last active
September 17, 2023 18:24
-
-
Save sh1mu7/55bbe7f8233e1db3e74a61954fd51797 to your computer and use it in GitHub Desktop.
Postgres Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################## 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'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@basharArif