Monday 2 December 2013

Postgresql DB Initialization in FreeBSD

Here are some command that used for administrating postgresql database.

The OS being use was FreeBSD9.1 with postgresql 8.3 


TO enable postgresql service add this in /etc/rc.conf :

postgresql_enable=”Yes”

postgresql_data=”/usr/local/pgsql/data”

postgresql_flags=”-w –s –m fast”

postgresql_initdb_flags=”—encoding=utf-8 –lc-collate=C”

postgresql_class=”default”



To install init db :

#/usr/local/etc/rc.d/postgresql initdb



We don’t have root user and a user in freebsd, so create one.

#su pgsql

#createuser dba    [set as
superuser]

Then change password :

#psql postgres dba

postgres=# ALTER
USER dba WITH PASSWORD ‘newpass’;

To create database :

#createdb mydb –o acong

[o] is owner of db

There we are. The database mydb ready to use and access from local host only.

Later on how to do backup and restore in Postgresql fast.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More