免费注册 查看新帖 |

Chinaunix

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

在简体中文XP安装PostgreSQL8.4时的问题(initdb错误) 解决! [复制链接]

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-04 13:24 |只看该作者 |倒序浏览
我在XP下安装PostgresQL8.4.1-1时,第一次安装不成功!卸载了!
今天再次安装,依旧不成功!用PGADMIN3连接不上,用NETSTAT -a居然发现没有监听5432端口;
不经意的发现data目录居然是空的,改到到bin目录,执行initdb时,发现有编码的错误(initdb: "China.936" is not a valid server encoding name),我就上网查找这个错误!
总算找到了。参照:http://old.nabble.com/postgresql ... PRC-td24300693.html
然后用命令initdb -U postgres --encoding=English --locale=utf8,成功了!
原来是PG对中文支持还不够啊。没办法!先凑合用吧。
下面是链接的原文:
postgresql 8.4 install failed on windows xp chinese PRC
View:  Threaded Chronologically All Messages New views 3 Messages — Rating Filter:  0 1 2 3 4 5   Alert me   

postgresql 8.4 install failed on windows xp chinese PRC
by 刘鑫 :: Rate this Message:   

Reply | Reply to Author | Print | View Threaded | Show Only this Message

system : windows xp Chinese simple
postgres : postgresql-8.4.0-1-windows.exe

installl processing and errors:

install failed by one click installer, then I run initdb.

F:\PostgreSQL\8.4\bin>initdb -U postgres --encoding=utf8 --locale=utf8 --lc-coll
ate='missing' F:\PostgresSQL\8.4\data
initdb: invalid locale name "utf8"
initdb: invalid locale name "'missing'"
initdb: invalid locale name "utf8"
initdb: invalid locale name "utf8"
initdb: invalid locale name "utf8"
initdb: invalid locale name "utf8"
The files belonging to this database system will be owned by user "刘鑫".
This user must also own the server process.

The database cluster will be initialized with locale Chinese_People's Republic o
f China.936.
initdb: could not find suitable text search configuration for locale Chinese_Peo
ple's Republic of China.936
The default text search configuration will be set to "simple".

creating directory F:/PostgresSQL/8.4/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in F:/PostgresSQL/8.4/data/base/1 ... ok
initializing pg_authid ... FATAL: database locale is incompatible with operatin
g system
DETAIL: The database was initialized with LC_COLLATE "Chinese_Peoples Republic
of China.936", which is not recognized by setlocale().
HINT: Recreate the database with another locale or install the missing locale.
child process exited with exit code 1
initdb: removing data directory "F:/PostgresSQL/8.4/data"

I reinstall and set LC_COLLATE to English, Unite State. It success.

March.Liu


Re: postgresql 8.4 install failed on windows xp chinese PRC
by ITAGAKI Takahiro-2 :: Rate this Message:   

Reply | Reply to Author | Print | View Threaded | Show Only this Message


?? <march.liu@...> wrote:

> system : windows xp Chinese simple
> postgres : postgresql-8.4.0-1-windows.exe
> F:\PostgreSQL\8.4\bin>initdb -U postgres --encoding=utf8 --locale=utf8

It's not a bug, just "utf8" is not a valid locale name.
Use the following instead:
$ initdb --encoding=UTF8 --locale="Chinese (Simplified)"

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



--
Sent via pgsql-bugs mailing list (pgsql-bugs@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: postgresql 8.4 install failed on windows xp chinese PRC
by Sachin Srivastava-2 :: Rate this Message:   

Reply | Reply to Author | Print | View Threaded | Show Only this Message



On 07/02/2009 09:17 AM, 刘鑫 wrote:
> system : windows xp Chinese simple
> postgres : postgresql-8.4.0-1-windows.exe
>
> installl processing and errors:
>
> install failed by one click installer, then I run initdb.
Can you please post the error part in the install logs present in your
system's temp directory (%TEMP%\install-postgresql.log) ?

--
Regards,
Sachin Srivastava
www.enterprisedb.com


--
Sent via pgsql-bugs mailing list (pgsql-bugs@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
2 [报告]
发表于 2010-01-20 22:58 |只看该作者

回复 #1 renxiao2003 的帖子

① 到 http://www.postgresql.org/ 下载 PostgreSQL for Win 的 no installer 版本。现在最新的版本是8.2.5-1。直接解压就可以了。例如:
C:\postgreSQL
② 设置环境变量
C:> set PGHOME=C:\postgreSQL
C:> set PGDATA=%PGHOME%\data
C:> set PGLIB=%PGHOME%\lib
C:> set PGHOST=localhost
C:> set PATH=%PGHOME%\bin;%PATH%

③ initdb 初始化 数据库。
④ pg_ctl start 启动数据库
⑤ pg_ctl stop 停止数据库
⑥ post_svc -install 建立windows nt 服务(需要设置系统环境变量)
⑦ post_svc -remove 删除 windows nt 服务
⑧ 使用"createdb 库名" 新建数据库
⑨ 使用"createuser 用户名"创建数据库帐号
⑩ 使用"psql -h localhost -d 库名- U 用户名"进入数据库


提示:
对于入门者可以使用GUI管理工具 pgAdmin。

另附:

今天在整理资料的时候发现,Postgre出现了解压缩直接使用的版本,上边注明了for expert only. 呵呵,看来,不推荐生手使用。
为了试验一把,索性从它的官网上直接下载了一份postgresql-8.3.3-1-binaries-no-installer.zip

1. 将其解压到d:\pgsql8.3.3
2. 设置环境变量,我不想直接添加,而是写到了一个batch文件里,名为pgenv.bat
set PGHOME=d:\pgsql8.3.3
set PATH=%PGHOME%\bin;%path%
set PGHOST=localhost
set PGLIB=%PGHOME%\lib
set PGDATA=%PGHOME%\data

3.
执行 pgenv.bat
然后:
D:\pgsql8.3.3\bin>initdb
属于此数据库系统的文件宿主为用户 "******".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale Chinese_People's Republic of China.936 初始化.
initdb: locale Chinese_People's Republic of China.936 requires unsupported encod
ing GBK
Encoding GBK is not allowed as a server-side encoding.
Rerun initdb with a different locale selection.

这上边的意思好像是说不直接支持cp936, GBK,晕。于是,强制执行:
D:\pgsql8.3.3\bin>initdb --locale=zh_CN
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
initdb: 无效的 locale 名字 "zh_CN"
属于此数据库系统的文件宿主为用户 "hex".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale Chinese_People's Republic of China.936 初始化.
initdb: locale Chinese_People's Republic of China.936 requires unsupported encod
ing GBK
Encoding GBK is not allowed as a server-side encoding.
Rerun initdb with a different locale selection.

还是不行,再换成下边的:
D:\pgsql8.3.3\bin>initdb --locale=C (今天在家安装再次不成功,改用这个命令成功)
属于此数据库系统的文件宿主为用户 "hex".
此用户也必须为服务器进程的宿主.
数据库簇将带有 locale C 初始化.
默认的数据库编码已经相应的设置为 SQL_ASCII.
The default text search configuration will be set to "english".
创建目录 d:/pgsql8.3.3/data ... 成功
creating subdirectories ... 成功
选择默认最大联接数 (max_connections) ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
创建配置文件 ... 成功
在 d:/pgsql8.3.3/data/base/1 中创建 template1 数据库 ... 成功
initializing pg_authid ... 成功
initializing dependencies ... 成功
创建系统视图 ... 成功
loading system objects' descriptions ... 成功
创建字符集转换 ... 成功
creating dictionaries ... 成功
对内建对象设置权限 ... 成功
创建信息模式 ... 成功
清理数据库 template1 ... 成功
拷贝 template1 到 template0 ... 成功
copying template1 to postgres ... 成功
警告: 为本地连接启动了 "trust" 认证.
你可以通过编辑 pg_hba.conf 更改或你下
次运行 initdb 时使用 -A 选项.
Success. You can now start the database server using:
"postgres" -D "d:/pgsql8.3.3/data"
or
"pg_ctl" -D "d:/pgsql8.3.3/data" -l logfile start

本文来自: (www.91linux.com) 详细出处参考:http://www.91linux.com/html/arti ... 20090331/16326.html

[ 本帖最后由 renxiao2003 于 2010-1-20 23:00 编辑 ]

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
3 [报告]
发表于 2010-01-21 16:15 |只看该作者
虽然是8.2版本。其实这个方法适合8.4;也不明白为什么不好使,原来在多语言版本下安装是没有问题的啊。

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
4 [报告]
发表于 2010-01-26 21:20 |只看该作者
这个倒没注意,一路NEXT下来的。

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
5 [报告]
发表于 2010-01-28 17:09 |只看该作者
我实验了,确实是在安装时,开始采用的是default,另7#,安装cluster使用哪个软件?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP