微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

原文地址:https://www.jb51.cc/postgresql/197451.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐