--- lang: ja-jp breaks: true --- # PostgreSQL ユーザの追加 2021-04-14 ## postgresユーザになる postgresユーザにパスワードを設定していない場合、 一旦rootになり、その後postgresユーザになる。 ```shell= $ su - パスワード: # su - postgres ``` ## PostgreSQLにユーザを追加する。 ```shell= $ createuser -P [new username] Enter password for new role: Enter it again: ``` ## 確認 ```shell= $ psql psql (12.6 (Ubuntu 12.6-0ubuntu0.20.10.1)) Type "help" for help. postgres-# \du List of roles Role name | Attributes | Member of -------------+------------------------------------------------------------+----------- newusername | | {} postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} ``` ###### tags: `PostgreSQL`