您的位置:首页 > 数据库

postgresql服务器启动和数据库的建立

2007-08-05 13:37 555 查看
Windows环境下使用postgresql:
遇到的问题;
1:initdb建立数据簇后,需先启动数据库服务器,否则会出现下列错误:
psql:无法连接到服务器: Connection refused(0x0000274D/10061)
服务器是否在主机“???”上运行并且准备接受在端口5432上的TCP/IP联接?
更正方法:启动数据库服务器:"postgres" -D "data" 或 "pg_ctl" -D "data" -logfile start

2:启动服务器后,在另外一个命令行窗口中建立数据库:create mydb
错误提示:createdb:无法连接到数据库postgres :FATAL: missing or erroneous pg_hba.conf file
log details: role "Localhost" does not exist
更正方法:指定超级用户名:createdb -U postgres -W mydb

最终正确操作过程:
1. 安装postgresql ,版本:postgresql-8.2.4-1-binaries-no-installer.zip--
http://wwwmaster.postgresql.org/redir?setmir=226&typ=h&url=http://ftp2.au.postgresql.org/pub/postgresql//binary/v8.2.4/win32/postgresql-8.2.4-1-binaries-no-installer.zip

2. 安装补丁:postgres_win32_patch.rar:http://bbs.pgsqldb.com/index.php?t=getfile&id=3725&rid=&S=7b0e2fdbb539b0485edadd37144c5e45

3.设置系统环境变量,如:c:/pgsql/data;c:/pgsql/bin;c:/pgsql/lib:

4.建立数据簇:initdb -U postgres -W -D %postgresql install path%/ data

5.启动数据库服务器:"postgres" -D "data" 或 "pg_ctl" -D "data" -logfile start

6.建立数据库:createdb -U postgres -W mydb,
或者:
psql -U postgres;
create database kantoo
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐