說實在的,我的這個 LAMP 網站,其實是不能遺忘這頭大象的.MySQL 是一條輕快的小海豚,但是缺少很多現代關係資料庫應有的特色,例如:引用完整性,視圖,觸發器等.因此,如果你需要開發一個電子商務的網站,需要這些功能的話,你或許應該考慮 PostgreSQL 了.本文將通過其在 Red Hat 7.1 上安裝過程,簡要介紹其用法.
以 postgres 用戶登錄, # su - postgre 建立資料庫目錄: $ mkdir data
啟動資料庫引擎:
$ initdb [postgre@www postgre]$ initdb This database system will be initialized with username "postgre". This user will own all the data files and must also own the server process.
Fixing permissions on pre-existing data directory /home/postgre/data Creating database system directory /home/postgre/data/base Creating database XLOG directory /home/postgre/data/pg_xlog Creating template database in /home/postgre/data/base/template1 Creating global relations in /home/postgre/data/base Adding template1 database to pg_database
Success. You can now start the database server using:
/usr/local/pgsql/bin/postmaster -D /home/postgre/data or /usr/local/pgsql/bin/pg_ctl -D /home/postgre/data start
$ postmaster -i -D ~/data & [1] 22603 [postgre@www postgre]$ DEBUG: Data Base System is starting up at Thu Jan 31 02:00:44 2002 DEBUG: Data Base System was shut down at Thu Jan 31 01:57:58 2002 DEBUG: Data Base System is in production state at Thu Jan 31 02:00:44 2002
這樣 PostgreSQL 使用位於 /usr/local/pgsql/data 的資料庫,允許 Internet 用戶的連接( -i ) ,並在後台運行.