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

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...