Asianux Server 3 đã được tích hợp Postgresql 8.1.9
Kiểm tra các gói cài đặt
[root@vportal ~]# rpm -qa | grep postgresql
postgresql-docs-8.1.9-1.1AX
postgresql-tcl-8.1.9-1.1AX
postgresql-python-8.1.9-1.1AX
freeradius-postgresql-1.1.3-1.2
postgresql-pl-8.1.9-1.1AX
postgresql-contrib-8.1.9-1.1AX
postgresql-libs-8.1.9-1.1AX
postgresql-jdbc-8.1.407-1jpp.4
postgresql-8.1.9-1.1AX
postgresql-server-8.1.9-1.1AX
postgresql-devel-8.1.9-1.1AX
postgresql-odbc-08.01.0200-3.1
Thư mục cài đặt /var/lib/pgsql/
Thiết lập để kết nối cơ sở dữ liệu từ các máy khác trong mạng
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '192.168.10.213' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
port = 5432
max_connections = 100
/var/lib/pgsql/data/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 192.168.10.213 255.255.255.0 trust
Đăng nhập vào postgresql
[root@vportal ~]# su postgres
bash-3.1$
Xem các cơ sở dữ liệu đã tạo
bash-3.1$ psql -d template1
WARNING: password file "/var/lib/pgsql/.pgpass" has world or group read access; permission should be u=rw (0600)
Welcome to psql 8.1.9, 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
template1=# \l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
khcn | khcn | UTF8
postgres | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(4 rows)
Để đổi mật khẩu của super User của Postgresql
template1=# ALTER USER postgres WITH PASSWORD 'new_password';
Đổi mật khẩu user trong Postgresql
template1=# ALTER USER user_name WITH PASSWORD 'new_password';
Khởi động dịch vụ postgresql
/etc/init.d/postgresql restart
Hoặc
service postgresqld restart
Chúc bạn thành công với cơ sở dữ liệu Postgresql