- 追加された行はこの色です。
- 削除された行はこの色です。
&tag(PostgreSQL);
*目次 [#m5abe6df]
#contents
*関連ページ [#q38be8ee]
*参考情報 [#ae594a69]
*ユーザー操作 [#pfe1b866]
-デフォルト管理者はpostgres
-ユーザーのパスワードなどは/etc/passwdを利用。
-データベースユーザーはシステムアカウントと連携する(/etc/passwdを利用)し、独自に設定することもできる。
-アクセス制御はpg_hba.confで行う?
** ユーザー登録 [#m53d3adc]
ユーザーの生成は、
デフォルトのデータベースの管理者postgresにsuして(デフォルトでユーザーpostgresにはパスワードが設定されてないのでルートを経由する)、createuserする。
-ユーザーの生成は、デフォルトのデータベースの管理者postgresにsuして(デフォルトでユーザーpostgresにはパスワードが設定されてないのでルートを経由する)、createuserする。
#pre{{
$ su root
# su postgres
$ createuser sora
$ ...allowd create databases? y
$ ...allowed to add users? y
}}
***ユーザー削除 [#ec804ec9]
-destroyuser ユーザー名で削除できる
**ユーザー削除 [#ec804ec9]
-dropuser ユーザー名で削除できる
#pre{{
$ destroyuser sora
$ dropuser sora
}}
**ユーザーの権限設定 [#dbd1dd04]
-管理者で接続
psql -U postgres
-以下のコマンドを実行
select * from pg_roles;
-例えばデータベースを作成したい場合、rolcreatedbがtになっていないとだめ。ユーザーtomにcreatedb権限を与える場合以下のように実行する。
alter role tom createdb;
*テーブル操作 [#q7ddd792]
**テーブル一覧 [#u035277f]
-シェルから実行
psql -l