Tuesday, March 18, 2014

PostgreSQL 9.3 initial setup on Mac OSX 10.9.2

After sudo port install postgresql93 postgresql93-server


# switch to su
sudo su

mkdir /var/lib/pgsql/

chown -R postgres:wheel /var/lib/pgsql

su postgres

export PGDATA=/var/lib/pgsql/9.3/data

initdb

createdb pgdbname

createuser -A -D pgusername

exit

exit

# startdb
sudo -u postgres postgres -D /var/lib/pgsql/9.3/data/

# check if login works
psql -h localhost pgdbname pgusername

\q

# add PGDATA to ~/.bash_profile
echo "export PGDATA=/var/lib/pgsql/9.3/data" >> ~/.bash_profile

Related Posts Plugin for WordPress, Blogger...