2007年9月11日火曜日

PostgreSQL最初の設定

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

ユーザ:postgres
データベース(/var/lib/pgsql/data)の初期化
$ initdb -D /var/lib/pgsql/data --encoding=UTF-8 --no-locale
(上の場合は文字コードをUNICODE(UTF-8)にしている)
(091021 --no-locale追加--locale=Cと同義、これをしないと日本語のソートに問題が発生)

ユーザ:root
PostgreSQLを起動
$ /etc/init.d/postgresql start
PostgreSQLの標準のラン・レベルをonに
$ chkconfig postgresql on
ユーザpostgresのパスワードを設定
$ psql -U postgres template1
template1=# ALTER USER postgres WITH PASSWORD '任意のパスワード';
template1=# \q (←psqlの終了)

/var/lib/pgsql/data/pg_hba.confの以下の行を場合によっては修正
local all all trust

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

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

0 件のコメント: