postgres安装数据库集群初始化失败(Postgresql 9.4.4版)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32453451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
postgres installation the database cluster initialization failed ( Postgresql Version 9.4.4 )
提问by xAminex
I can't install Postgresql. I've tried everything:
我无法安装 Postgresql。我已经尝试了一切:
- I run the setup as Administrator.
- I create a postgresql user an I add it to the Administrator group.
- I install it directly on C:\postgresql.
- 我以管理员身份运行安装程序。
- 我创建了一个 postgresql 用户并将其添加到管理员组。
- 我直接将它安装在 C:\postgresql 上。
but without any success. for information: I have windows 8
但没有任何成功。信息:我有 Windows 8
采纳答案by ISONecroMAn
- First of all run the set-up as administrator.
- Choose the installation folder inside program files( default)
- But chose your data location outside from above folder to somewhere else ( c:\postgres data or something.)
- 首先以管理员身份运行设置。
- 选择程序文件中的安装文件夹(默认)
- 但是从上面的文件夹之外选择你的数据位置到其他地方( c:\postgres data 或其他东西。)
回答by ThangLeQuoc
it's 2019, and I still have the same issue with Postgres 11. Before that, I remove the current Postgres 9.6 (if I remember the version correctly), and attempt to install the new one Postgres 11, and got the issue. I have try these following approaches, but none of them work:
现在是2019 年,我仍然对Postgres 11有同样的问题。在此之前,我删除了当前的 Postgres 9.6(如果我没记错版本的话),并尝试安装新的 Postgres 11,但出现了问题。我尝试了以下这些方法,但它们都不起作用:
- Run installation as Administrator on every run -> failed
- Choose the default installation folder that the setup prompted (C:/Program Files/PostgresSQL/11), and the data folder reside at other place -> failed
- Install it on a place outside C:/ -> still failed
- 在每次运行时以管理员身份运行安装 -> 失败
- 选择安装程序提示的默认安装文件夹(C:/Program Files/PostgresSQL/11),数据文件夹在其他地方->失败
- 将其安装在 C:/ 之外的地方 -> 仍然失败
The only approach that I luckily found after scratching my head nearly the whole day is with this post
I would like to quickly recap the solution in case the the link expired
我幸运地在几乎一整天挠头后找到的唯一方法是这篇文章,
我想快速回顾一下解决方案,以防链接过期
Solution:
- Uninstall PostgreSQL
- CMD: net user postgres /delete
- Control Panel -> User Accounts -> Configure advanced user profile properties -> delete all "Unknown User" instances that seem to be left from postgres
- Run > compmgmt.msc -> Local Users and Groups -> Users -> New User... -> User name: postgres, Password: postgres -> Create
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Administrators -> OK
- copy postgresql-8.4.9-1-windows.exe to C:\
- runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1-windows.exe -> installed successfully without errors. Checked data folder and confirmed files created successfully. (this mean you mustrun the installation with the created postgresuser)
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Administrators -> Remove
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Power Users -> OK
- Installed HM2 -> created db successfully
- Restarted computer -> HM2 runs properly (i.e. just to check postgresql service starts automatically)
解决方案:
- 卸载 PostgreSQL
- CMD:net user postgres /delete
- 控制面板 -> 用户帐户 -> 配置高级用户配置文件属性 -> 删除似乎从 postgres 中留下的所有“未知用户”实例
- 运行 > compmgmt.msc - > 本地用户和组 -> 用户 -> 新用户... -> 用户名:postgres,密码:postgres -> 创建
- compmgmt.msc -> 本地用户和组 -> 用户 -> postgres -> 成员 ->添加... -> 管理员 -> 确定
- 将 postgresql-8.4.9-1-windows.exe 复制到 C:\
- runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1- windows.exe -> 安装成功,没有错误。检查数据文件夹并确认文件创建成功。使用创建的postgres用户运行安装)
- compmgmt.msc -> 本地用户和组 -> 用户 -> postgres -> 成员 -> 管理员 -> 删除
- compmgmt.msc -> 本地用户和组 -> 用户 -> postgres -> 成员 -> 添加... -> 高级用户 -> 确定
- 安装 HM2 -> 成功创建数据库
- 重新启动计算机 -> HM2 运行正常(即只是为了检查 postgresql 服务是否自动启动)
Pro Tips:To get an insight of the installation log, go to %TEMP% folder by searching for "%TEMP%" in the task bar, the log name would be bitrock_installer-xxx.log
. You would want to know what is going on to troubleshoot the issue faster.
专业提示:要深入了解安装日志,请通过在任务栏中搜索“%TEMP%”转到 %TEMP% 文件夹,日志名称将为bitrock_installer-xxx.log
. 您想知道发生了什么以更快地解决问题。
回答by Basil
Just don't use EDB installer. There is BigSQL alternative now.
只是不要使用 EDB 安装程序。现在有 BigSQL 替代方案。
回答by Shamil Puthukkot
I was facing the same issue on trying to install postgres 10.3.Running as the administrator didn't help me. But it got installed properly when i changed the installation directory from the default one which is inside Program Files.Instead i created a new folder inside the C drive and made it the installation directory.
我在尝试安装 postgres 10.3 时遇到了同样的问题。以管理员身份运行并没有帮助我。但是当我从 Program Files 中的默认安装目录更改安装目录时,它已正确安装。相反,我在 C 驱动器中创建了一个新文件夹并将其设为安装目录。
回答by Carlitos Way
I was installing the Postgres version 9.5 (On windows 7 and using the DBEnterprise installer)... for me, the problem seems to be that I was selecting "POSIX" as Regional Configuration... But I tried with the "C" Regional Configuration, and the installation finished without any problem...
我正在安装 Postgres 9.5 版(在 Windows 7 上并使用 DBEnterprise 安装程序)......对我来说,问题似乎是我选择了“POSIX”作为区域配置......但我尝试使用“C”区域配置,安装完成没有任何问题...
Also, I run the installer as Administrator!
另外,我以管理员身份运行安装程序!
回答by xAminex
Problem solved:
问题解决了:
run the setup as Administrador and use Windows 7 mode
以管理员身份运行安装程序并使用 Windows 7 模式
回答by umang-malhotra
I followed steps suggested by @IsoNecroMad and it worked
我按照@IsoNecroMad 建议的步骤操作,并且奏效了
1) First of all, run the set-up as administrator.
1)首先,以管理员身份运行设置。
2) Choose the installation folder inside program files( default)
2)选择程序文件中的安装文件夹(默认)
3) But chose your data location outside from above folder to somewhere else ( c:\postgres data or something.)
3)但是从上面的文件夹之外选择你的数据位置到其他地方( c:\postgres data 或其他东西。)
回答by superodde
I tried and failed several times thinking it was somthing to do with rights and user used during the installation. But thanks to ThangLeQuoc's pro tip to inspect the installation log I found the cause:
我尝试并失败了几次,认为这与安装过程中使用的权限和用户有关。但是多亏了 ThangLeQuoc 检查安装日志的专业提示,我找到了原因:
initdb: invalid locale name "NorwegianBokm?l,Norway"
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb
initdb: 无效的语言环境名称“NorwegianBokm?l,Norway”
Called Die(无法使用 initdb 初始化数据库集群)...
使用 initdb 初始化数据库集群失败
So after selecting 'default locale' during the installation process it all went fine. This was on version 11.6 os Postgres.
因此,在安装过程中选择“默认语言环境”后,一切顺利。这是在 11.6 版 os Postgres 上。
回答by Zbyl
I had the same error, but with different underlying problem (not user permissions but a locale problem). Solution for this is described here: Win 10 Postgresql 11 database cluster initialisation failed
我有同样的错误,但有不同的潜在问题(不是用户权限,而是区域设置问题)。此处描述了对此的解决方案:Win 10 Postgresql 11 database cluster initialisation failed
回答by Spectarion
Possible solution for 10.3. version:
10.3 的可能解决方案。版本:
Move downloaded file to C:\ drive.
Example: C:\postgresql-10.3-2-windows-x64.exeCreate directory named PostgreSQLin C:\ drive
Create directory named 10in previously created PostgreSQL directory.
So you need to have C:\PostgreSQL\10.Run C:\postgresql-10.3-2-windows-x64.exe(DO NOT CLICK ON 'RUN AS ADMIN', just double click)
Change installation directory path to C:\PostgreSQL
Change data directory path to C:\PostgreSQL\data
Finish
将下载的文件移动到 C:\ 驱动器。
示例:C:\postgresql-10.3-2-windows-x64.exe在 C:\ 驱动器中创建名为PostgreSQL 的目录
在之前创建的 PostgreSQL 目录中创建名为10 的目录。
所以你需要有C:\PostgreSQL\10。运行C:\postgresql-10.3-2-windows-x64.exe (不要单击“以管理员身份运行”,只需双击)
将安装目录路径更改为C:\PostgreSQL
将数据目录路径更改为C:\PostgreSQL\data
结束
Hopefully, installation should be successful.
希望安装成功。