Postgresql setting

/etc/postgresql/8.1/main/pg_hba.conf
==================================================



# Database administrative login by UNIX sockets
#local all postgres ident sameuser
local all postgres trust

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# “local” is for Unix domain socket connections only
#local all all ident sameuser
local all all trust

# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.1.0/24 md5
# IPv6 local connections:
host all all ::1/128 md5
==================================================
/etc/postgresql/8.1/main/postgresql.conf
==================================================


#listen_addresses = ‘localhost’ # what IP address(es) to listen on;
listen_addresses = ‘*’
# comma-separated list of addresses;
# defaults to ‘localhost’, ‘*’ = all
port = 5432
max_connections = 100
==================================================
set Password ‘postgres’ pertama
==================================================
root@server-desktop:/home/repo# /etc/init.d/postgresql-8.1 restart
* Restarting PostgreSQL 8.1 database server [ OK ]

root@server-desktop:/home/repo# psql -U postgres postgres
Welcome to psql 8.1.8, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

postgres=# alter role postgres encrypted password ‘9876’;
ALTER ROLE
postgres=# \q
root@server-desktop:/home/repo#

install PL (PLPGSQL) di template1
karena template1 adalah database template untuk di-clone/duplikat ketika kita membuat database baru. Jadi kalau kita buat language disitu otomatis dataabase baru yg kita buat selanjutnya akan sudah termasuk language tsb.  ==================================================
root@server-desktop:/home/repo# createlang -U postgres plpgsql template1
root@server-desktop:/home/repo#

Install DBLink di template1
root@server-desktop:/home/repo# psql -U postgres template1 < /usr/share/postgresql/8.1/contrib/dblink.sql

create role (user) ‘muki’
==================================================
root@server-desktop:/home/repo# psql -U postgres postgres
Welcome to psql 8.1.8, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

postgres=# \h create role
Command: CREATE ROLE
Description: define a new database role
Syntax:
CREATE ROLE name [ [ WITH ] option [ … ] ]

where option can be:

SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| CREATEUSER | NOCREATEUSER
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
| CONNECTION LIMIT connlimit
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD ‘password’
| VALID UNTIL ‘timestamp’
| IN ROLE rolename [, …]
| IN GROUP rolename [, …]
| ROLE rolename [, …]
| ADMIN rolename [, …]
| USER rolename [, …]
| SYSID uid

postgres=# create role muki createdb login encrypted password ‘9876’;
CREATE ROLE
postgres=#

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: