Postgresqlをインストールした直後に必要となる設定

2010年2月14日

Postgresqlをインストールしたら、最初にやらないといけないのが DB向けのユーザアカウントです。

また、Webサーバからの読み書き(R/W)に対応しようと思うと、Debianだとwww-dataユーザに対してアクセス権限を与えたりしなければ なりません。


その設定のためのコマンドを以下に記述しておきます。

1
2
3
4
5
6
7
8
9
# DB向けユーザアカウントの作成 
$ createusr user_name
# ユーザアカウントの削除 
$ dropuser postgres_user_name
# www-dataからDBにアクセスするための設定 
$ createuser www-data
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n