博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

上帝他爷

分别担任CU、ITPUB以及CSDN社区的MySQL版主! 我本来想说我是吃屎的! ^_^
  yueliangdao0608.cublog.cn

关于作者
姓名:杨涛
职业:DBA
年龄:25
位置:中国-武汉市
个性介绍:又长了一岁
QQ:38257291
MSN:yueliangdao0608@gmail.com
|| << >> ||
我的分类


[原创]PostgreSQL安装体验
今天开始利用闲暇时间来学点PGSQL。下面我贴出我的初次安装体验。
1、遇到两个错误:
  1)、configure: error: readline library not found
  解决方法:
  安装libtermcap-devel-2.0.8-46.1.i386.rpm
  和readline-devel-5.1-1.1.i386.rpm
  安装过程就不多说了。
  checking for inflate in -lz... no
  2)、configure: error: zlib library not found 
  解决方法:
  安装zlib-devel-1.2.3-3.i386.rpm
  然后./configurate;make;make install
  如果到了这一步就表示安装成功了。
  PostgreSQL installation complete.
 PGSQL 安装成功
2、后续设置
[root@localhost pgsql]# make dir /usr/local/pgsql/data
POSTGRE好像不能用ROOT来操作。只能用普通用户。
[root@localhost pgsql]# adduser postgres
[root@localhost pgsql]# chown -R postgres /usr/local/pgsql/data/
初始化数据库:
[root@localhost pgsql]# su postgres
[postgres@localhost pgsql]$ ./bin/initdb -D /usr/local/pgsql/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    ./bin/postgres -D /usr/local/pgsql/data
or
    ./bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

用POSTGRES用户启动PGSQL服务进程
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
实际操作
也可以这样启动PGSQL服务进程
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/logfile start
做成服务自动启动
[root@localhost start-scripts]# cp /usr/local/pgsql/contrib/start-scripts/linux /etc/init.d/pgsql
[root@localhost start-scripts]# chkconfig --add pgsql
[root@localhost start-scripts]# service pgsql status
pg_ctl: server is running (PID: 7019)
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
[root@localhost start-scripts]# export PATH=$PATH:/usr/local/pgsql/bin/

[postgres@localhost ~]$ createdb t_girl
CREATE DATABASE
[postgres@localhost ~]$ psql t_girl
Welcome to psql 8.2.6, 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

t_girl=# select version();
                                              version                                               
----------------------------------------------------------------------------------------------------
 PostgreSQL 8.2.6 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)
(1 row)
t_girl=# \q
[postgres@localhost ~]$ dropdb t_girl
DROP DATABASE
更多见:
http://www.pgsqldb.org/pgsqldoc-8.1c/postmaster-start.html


发表于: 2008-02-03,修改于: 2008-02-27 16:22,已浏览876次,有评论2条 推荐 投诉


网友评论
网友: 本站网友 时间:2008-02-16 11:27:53 IP地址:222.65.30.★
pgsqldb.org 维护的 pg 官方中文手册就可以了。

Blog作者的回复:
呵呵。我也就是记录一下我的学习经历。


网友: vyouzhi 时间:2008-08-12 09:28:49 IP地址:116.232.95.★
我这儿在也玩postgesql,它的魅力很不错

 发表评论