·年薪50000就业保证,北京/上海任选就业! 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 ) ,并在后台运行。