加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-13 18:02:15 所属栏目:百科 来源:网络整理
导读:Windows环境下使用postgresql: 遇到的问题; 1:initdb建立数据簇后,需先启动数据库服务器,否则会出现下列错误: psql:无法连接到服务器: Connection refused(0x0000274D/10061) 服务器是否在主机“???”上运行并且准备接受在端口5432上的TCP/IP联接? 更正
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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读