- 论坛徽章:
- 0
|
来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=NHibernate assword=NHibernate;Database=MemberShip"/>
And pls notice that the connection_string is case sensitive for postgresql server.
------------------------------------ |
|