sudo -u postgres psqlCREATE DATABASE dbname;
CREATE USER username WITH ENCRYPTED PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE dbname TO username;Update user's password
ALTER USER username WITH PASSWORD 'new-password';| Postgresql on Debian |
| sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
| wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
| sudo apt-get update | |
| sudo apt-get -y install postgresql |
| # /etc/postgresql/13/main/postgresql.conf | |
| # ... | |
| # - Connection Settings - | |
| listen_addresses = '*' |
| # /etc/postgresql/13/main/pg_hba.conf | |
| # ... | |
| # Add: | |
| # | |
| # Allow from private network | |
| host all all 10.0.0.1/24 trust |
| pg_ctlcluster 13 main reload |
sudo -u postgres psqlCREATE DATABASE dbname;
CREATE USER username WITH ENCRYPTED PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE dbname TO username;Update user's password
ALTER USER username WITH PASSWORD 'new-password';