sudo port install postgresql84-server
sudo port install php5-postgresql +postgresql84
sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb sudo chown postgres:postgres /opt/local/var/db/postgresql84/defaultdb sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
ローカル環境なので、他のホストからの通信を許可する 例)10.0.1.7から
sudo vi /opt/local/var/db/postgresql84/defaultdb/pg_hba.conf
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 10.0.1.7/32 trust
# IPv6 local connections:
host all all ::1/128 trust
sudo vi /opt/local/var/db/postgresql84/defaultdb/postgresql.conf
listen_addresses = '*'
//起動
sudo -u postgres /opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb -o "-i" -m immediate start
//停止
sudo -u postgres /opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb -o "-i" -m immediate stop
//再起動
sudo -u postgres /opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb -o "-i" -m immediate restart
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist
sudo -u postgres /opt/local/lib/postgresql84/bin/createdb -U postgres -E UNICODE データベース名