macportsでインストールしたポスグレについて

2009-08-23 - くりまるwebつくる
入れただけで、使ってなかったんですが。initdbでいきなりつまづいた

crimaru-macbook:local coek$ sudo /opt/local/pgsql/bin/initdb -D /opt/local/var/db/postgres84/db --encoding=utf-8 --no-locale
initdb: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
crimaru-macbook:local coek$ sudo 

sudo su postgres -c ' が必須っぽい

coek-macbook:local coek$ sudo su postgres -c '/opt/local/pgsql/bin/initdb -D /opt/local/var/db/postgres84/db --encoding=utf-8 --no-locale'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

fixing permissions on existing directory /opt/local/var/db/postgres84/db ... ok
creating subdirectories ... ok

以下略

起動した

crimaru-macbook:local coek$ sudo su postgres -c '/opt/local/pgsql/bin/psql -l'
                              List of databases
   Name    |  Owner   | Encoding | Collation | Ctype |   Access privileges   
-----------+----------+----------+-----------+-------+-----------------------
 postgres  | postgres | UTF8     | C         | C     | 
 template0 | postgres | UTF8     | C         | C     | =c/postgres
                                                     : postgres=CTc/postgres
 template1 | postgres | UTF8     | C         | C     | =c/postgres
                                                     : postgres=CTc/postgres
(3 rows)

勢いで8.4を入れてみたけど、なんかすげーかわった。。。