2010年12月17日金曜日

PostgreSQL84最初の設定


ユーザ:root
インストール
yum install postgresql84-server

データベースの初期化をinit.dからできるるようになったので以下のようにDBを初期化する。
$ /etc/init.d/postgresql initdb

PostgreSQLを起動
$ /etc/init.d/postgresql start
PostgreSQLの標準のラン・レベルをonに
$ chkconfig postgresql on

ユーザpostgresのパスワードを設定
Ident認証になっているのでrootで$ psql -U postgres template1としてもはじかれるので一度postgresになってからDBに入る
$ su postgres
$ psql template1
template1=# ALTER USER postgres WITH PASSWORD '任意のパスワード';
template1=# \q (←psqlの終了)

/var/lib/pgsql/data/pg_hba.confを場合によっては修正

PostgreSQLを再起動
$ /etc/init.d/postgresql restart

ユーザ:postgres
$ createuser ユーザ名
$ createdb -E エンコーディング -O オーナー名 DB名