feat: adjust postgres-create-user.md

This commit is contained in:
dancingCycle 2022-09-09 11:47:46 +02:00
parent e434cb5e7a
commit ce43b5c80f
1 changed files with 6 additions and 1 deletions

View File

@ -7,10 +7,15 @@
* create a database user called <user name> with password <key>
```
sudo -u postgres psql -W
CREATE USER <user name> with encrypted password <key>;
CREATE USER <user name> with encrypted password '<key>';
grant all privileges on database <database name> to <user name>;
```
* OPTION: if <user name> already exist, pw can be changed this way
```
ALTER USER <user name> WITH ENCRYPTED PASSWORD '<key>';
```
* OPTION: gant user <user_name> access to database ```postgres``` so that this user is able to login without providing a database
```
sudo -u postgres psql -W