Postgre SQL
发布时间:2022-05-20 发布网站:大佬教程 code.js-code.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 proces
s.
The database cluster will be initialized with locale en_U
S.UTF-8.
The default database enCoding has accordingly been set to UTF8.
fixing permissions on exis
Ting directory /usr/local/pgsql/data ... ok
crea
Ting subdirectorIEs ... ok
SELEc
Ting default max_connections ... 100
SELEc
Ting default shared_buffers/max_fsm_pages ... 32MB/204800
crea
Ting configuration files ... ok
crea
Ting template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing
pg_authID ... ok
initializing dependencIEs ... ok
crea
Ting system vIEws ... ok
loading system ob
jects' descriptions ... ok
crea
Ting conversions ... ok
set
Ting privileges on built-in ob
jects ... ok
crea
Ting information
scheR_97_11845@a ... 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 edi
Ting
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 termina
l.
Type: \copyright for di
Stribution 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 (GC
C) 4.1.1 20070105 (Red Hat 4.1.1-52)
(1 row)
t_girl=# \q
[
POSTGRes@localhost ~]$ dropdb t_girl
DROP DATABASE
更多见:
[url]
http://www.pgsqldb
.org/pgsqldoc-8.1c/postmaster-start.html[/url]
大佬总结
以上是大佬教程为你收集整理的PostgreSQL安装体验全部内容,希望文章能够帮你解决PostgreSQL安装体验所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。