免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5614 | 回复: 3
打印 上一主题 下一主题

[原创]postgresql manully installation guid under windows [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-02-24 00:17 |只看该作者 |倒序浏览
来CU其实很久了,晃眼一看,我的postgresql已经成功安装在windows xp上整一年了(去年春节假期捣鼓成功的),现在我又成功地在vista上安装了。下面的笔记是我一年前写的。拿出来和大家分享(去年忙了一整年,昏天黑地的,呵呵)

我写笔记的时候用的就是英文,这里就不翻译了。当时是为了测试NHibernate做的,现在仍然有效。

------------------------------------
postgresql manully installation guid.

1.download postgresql-8.1.2-1-binaries-no-installer.zip from www.postgresql.org.

2.unzip the package to d:\ then we got d:\pgsql

3.testing for pg_dump.exe under d:\pgsql\bin and we got an error: can not find libpg.dll

4.switch to d:\pgsql\lib we can find libpg.dll

5.user regsvr32 libpg.dll got error message can not load the module. This means that this is not a activex module or com component.

6.In command.
        path d:\pgsql\lib\;%path%;
        cd d:\pgsql\bin
        pg_dump.exe
       
        The we got the pg_dump run. This means that the we may need to add d:\pgsql\lib;d:\pgsql\bin to the eviornment variables.
       
7.How to install pgsql as windows service

        Add a windows account( user: pgsql password:pgsql ) to local system.Then

        d:\pgsql\bin
        pg_ctl register -N pgsql -U pgsql -P pgsql -D d:\pgsql\data
       
        pg_ctl register   [-N 服务名称] [-U 用户名] [-P 口令] [-D 数据目录] [-w] [-o "选项"]
       
8.Uninstall the pgsql windows service
       
        pg_ctl unregister -N pgsql
       
        pg_ctl unregister [-N 服务名称]
       
        I got an application error while runing this.
       
        I can use instead:
        sc -delete pgsql
       
9.To register a Windows eventlog library with the operating system, issue this command after installation:

        This command is optional
       
        regsvr32 d:\pgsql\lib\pgevent.dll
       
9. init the database data directory       
        cd c:\windows\system32
        in cmd.exe context menu (run as...) logo on as pgsql with password:pgsql
        initdb -D d:\pgsql\data
       
        You should got a success message.

10. Start the service
       
        after the database was successfully created.
       
        pg_ctl start d:\pgsql\data
       
        The database service will successfull started.
       
        summary: Why should I run the cmd.exe as pgsql identity? Here comes the answer:
        I restart my computer and the use the following command:
        net start pgsql
        And the pgsql service started successfully.So I am not quite sure about why system restart was needed.But this works fine.
        And I succesfully init the database and got the service run.

11. The enterprise manager
        11.1 Install pgadmin III
        11.2 Config phpPgAdmin(php+apache2)

12. The querybrowser

13. About the tcp port
        The tcp port used by pgsql is 5432.
       
        If you want to change the port.You may take a look at the file:
        d:\pgsql\data\postgresql.conf and file this line:
       
        #port = 5432
       
        I believe we can change the tcp port here.
       
14. Tips
        I had init the database but forget to set the superuser's password.I just stop the pgsql service and then delete the files and
        folders under d:\pgsql\data.
        Using the following initdata command:
       
        initdata -D d:\pgsql\data -U jianglinchun -W
       
        The database will successfully init and password for jianglinchun(database super user) will be promot at the end of the message.

15. Note:
        14.1 Working with NHibernate.You need the following assembly:
        Mono.Security.dll
        Mono.Security.Protocol.Tls.dll
        Npgsql.dll
       
        The sample configuration:
        <add key="hibernate.dialect" value="NHibernate.Dialect.PostgreSQLDialect"/>
        <add key="hibernate.connection.driver_class" value="NHibernate.Driver.NpgsqlDriver"/>
        <add key="hibernate.connection.connection_string" value="server=localhost;User Id=NHibernateassword=NHibernate;Database=MemberShip"/>
       
        And pls notice that the connection_string is case sensitive for postgresql server.
------------------------------------

论坛徽章:
0
2 [报告]
发表于 2007-02-24 10:04 |只看该作者
谢谢,先收藏了.

论坛徽章:
0
3 [报告]
发表于 2007-02-26 15:03 |只看该作者
不错,虽然我也在Win上用,但楼主这就免除自己写笔记的麻烦了。收藏。

论坛徽章:
0
4 [报告]
发表于 2008-04-20 22:26 |只看该作者

回复 #1 jianglinchun 的帖子

大哥,对postgresql很有研究吧!帮我看看我最近遇到的问题好吗?http://bbs.chinaunix.net/thread-1083779-1-1.html
谢谢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP