Beranda > Linux, System Administrator > Installasi PostgresSQL untuk database server [CentOS6]

Installasi PostgresSQL untuk database server [CentOS6]

Berikut konfigurasi postgresQL yang saya install pada mesin virtual proc 2 core dan mem. 8GB.

verrysoon@kowalski#yum -y install postgresql-server
verrysoon@kowalski#/etc/rc.d/init.d/postgresql initdb
verrysoon@kowalski#nano /var/lib/pgsql/data/postgresql.conf

# line 59: listen all ip address
listen_addresses = '*'
# line 334: ganti log format
log_line_prefix = '%t %u %d'

verrysoon@kowalski#/etc/rc.d/init.d/postgresql start
verrysoon@kowalski#chkconfig postgresql on
verrysoon@kowalski#su - postgress
-bash-4.1$ psql -c "alter user postgres with password 'password'" (alter role)
-bash-4.1$ createuser soon (create db user cent)
Shall the new role be a superuser? (y/n) y
-bash-4.1$ su - soon
soon@kowalski#createdb testdb (create db)
soon@kowalski#psql -l (testing, seharusnya muncul list database)
soon@kowalski#psql testdb (connect db)
psql (8.4.7)
Type "help" for help.

# set password
testdb=# alter user soon with password 'password';

ALTER ROLE
# create a test table
testdb=# create table test ( no int,name text );

CREATE TABLE
# test input data
testdb=#insert into test (no,name) values (1,'cent');
INSERT 0 1

# confirm
testdb=# select * from test;

no | name
----+-------
1 | soon
(1 row)

# delete test table
testdb=#drop table test;

DROP TABLE
# quit
testdb=#\q

soon@kowalski#dropdb testdb (drop database)

  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s