在 PostgreSQL 安装期间无法将 sql 模块加载到数据库集群中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30689251/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:59:20  来源:igfitidea点击:

Failed to load sql modules into the database cluster during PostgreSQL Installation

postgresql

提问by John Theuerkauf

I have attempted to install PostgreSQL 9.4 and 8.4 multiple times and it is failing no matter what I have tried. I am attempting to install on Windows 7 SP1 x64. After each failed install I have uninstalled and deleted the installation folder to start fresh.

我曾多次尝试安装 PostgreSQL 9.4 和 8.4,但无论我尝试过什么,它都失败了。我正在尝试在 Windows 7 SP1 x64 上安装。每次安装失败后,我都卸载并删除了安装文件夹以重新开始。

Each time I attempt the install I get an error pop up near the end of installation that says: "failed to load sql modules into the database cluster".

每次我尝试安装时,我都会在安装结束时弹出一个错误消息: “无法将 sql 模块加载到数据库集群中”。

Then another error pop up displays immediately after that says: "Error running post install step. Installation may not complete correctly. Error reading C:/Program Files/PostgreSQL/9.4/postgresql.conf"

然后立即弹出另一个错误消息: “运行安装后步骤时出错。安装可能无法正确完成。读取 C:/Program Files/PostgreSQL/9.4/postgresql.conf 时出错”

I have attempted installation with the following actions:

我已尝试通过以下操作进行安装:

  • Always installed as administrator
  • Turned off all virus protection and windows firewall
  • Changed the installation directory to something other than the Program Files directory.
  • Changed the data directory to something other than the installation directory of postgres
  • 始终以管理员身份安装
  • 关闭所有病毒防护和 windows 防火墙
  • 将安装目录更改为 Program Files 目录以外的其他目录。
  • 将数据目录更改为 postgres 安装目录以外的其他目录

None of the actions above have helped and I always receive the error. Any help that someone can provide would be greatly appreciated!

上述操作都没有帮助,我总是收到错误消息。任何人可以提供的帮助将不胜感激!

采纳答案by Jeff G

I was getting this same error when trying to install PostgreSQL v9.4.4 on Windows 10 Pro. Starting with a solution hosted on Stack Exchange, I came up with the following steps that allowed the installer to run successfully:

尝试在 Windows 10 专业版上安装 PostgreSQL v9.4.4 时,我遇到了同样的错误。从Stack Exchange 上托管的解决方案开始,我想出了以下步骤,使安装程序能够成功运行:

1) Create a new user account, called postgres
2) Add the new account to the Administratorsand Power Usersgroups
3) Restart the computer
    NOTE: I added step #3, since step #4 didn't work without it
4) Run a command prompt as the postgres user, using the command:
    runas /user:postgres cmd.exe
5) Run the installer from the postgrescommand window
6) Delete the postgresuser account, as well as the user directory
    NOTE: I added step #6, since the postgres account is not required after installation

1) 创建一个名为postgres的新用户帐户
2) 将新帐户添加到AdministratorsPower Users
3) 重新启动计算机
    注意:我添加了第 3 步,因为没有它第 4 步不起作用
4) 运行命令提示符作为 postgres 用户,使用以下命令:
    runas /user:postgres cmd.exe
5) 从postgres命令窗口运行安装程序
6) 删除postgres用户帐户以及用户目录
    注意:我添加了步骤 #6 ,因为安装后不需要postgres账号

回答by gomisha

What worked for me is, during the install, specifying a Postgre SQL data folder that's outside of any Windows user profile directory (C:\Users), such as C:\postgres-data.

对我有用的是,在安装过程中,指定一个位于任何 Windows 用户配置文件目录 (C:\Users) 之外的 Postgre SQL 数据文件夹,例如 C:\postgres-data。

My setup:

我的设置:

  • Win 10 Pro

  • PostgreSQL 9.5 RC1

  • 赢 10 专业版

  • PostgreSQL 9.5 RC1

I ran into this issue when I tried setting PostgreSQL's data directory somewhere under my user profile's directory, such us somewhere under "My Documents".

当我尝试在我的用户配置文件目录下的某处设置 PostgreSQL 的数据目录时遇到了这个问题,比如我们在“我的文档”下的某处。

I tried Jeff G's solution and it didn't work at first. It worked only when I kept the data directory as the default (C:\Program Files\PostgreSQL\9.5\data). So then I tested further and tried setting the data directory to somewhere outside of any user profile directories (i.e. somewhere that isn't under C:\Users). For example, C:\postgres-data and this worked.

我尝试了 Jeff G 的解决方案,但一开始没有用。它仅在我将数据目录保留为默认目录 (C:\Program Files\PostgreSQL\9.5\data) 时才起作用。然后我进一步测试并尝试将数据目录设置到任何用户配置文件目录之外的某个地方(即不在 C:\Users 下的某个地方)。例如, C:\postgres-data 这有效。

I then just tried using that directory with my default user, and not bothering with the postgres temp user as outlined in Jeff G's solution and that also worked. So in the end, it had to do with my data directory being somewhere under C:\Users. As long as it was outside of that, it worked.

然后我只是尝试用我的默认用户使用该目录,而不是像 Jeff G 的解决方案中概述的那样打扰 postgres 临时用户,这也有效。所以最后,它与我的数据目录在 C:\Users 下的某个地方有关。只要在那个范围之外,它就起作用了。

回答by Slave

Encountered a very similar problem that OP is reporting today while installing Postgres 9.4.

在安装 Postgres 9.4 时遇到 OP 今天报告的一个非常相似的问题。

It turns out that the password generator I was using has made a password that contains non-alphanumeric characters. ("^") I believe was the culprit in this case. Removing that allowed the installation of Postgres 9.4 (Windows 64 bit) to complete.

事实证明,我使用的密码生成器创建了一个包含非字母数字字符的密码。(“^”)我相信是这种情况下的罪魁祸首。删除允许 Postgres 9.4(Windows 64 位)安装完成。

Very easy fix once you've found it, but the error message that comes up is not descriptive, so in this case I didn't notice at first what I was doing wrong.

一旦找到它就很容易修复,但是出现的错误消息不是描述性的,所以在这种情况下,我一开始没有注意到我做错了什么。

回答by Micer

None of these answers here helped me, finally I solved this problem by creating the folder before the installation (C:\PostgreSQL\data) and giving it full access for the group "Users".

这里的这些答案都没有帮助我,最后我通过在安装之前创建文件夹(C:\PostgreSQL\data)并为其提供“用户”组的完全访问权限来解决这个问题。

Windows 7 x64, postgresql-9.5.2-1-windows-x64

Windows 7 x64,postgresql-9.5.2-1-windows-x64

回答by RK-Rohan

Hope It's Work.

希望这是工作。

1.)Uninstall PostgreSQL

1.) 卸载 PostgreSQL

2.)Delete the postgres user if it still exists :

2.) 删除 postgres 用户(如果它仍然存在):

net user postgres /delete

净用户 postgres /delete

3.) Create the postgres user with a password you can remember:

3.) 使用您可以记住的密码创建 postgres 用户:

net user /add postgres

网络用户/添加 postgres

4.) Add the postgres user to the Administrators group:

4.) 将 postgres 用户添加到管理员组:

net localgroup administrators postgres /add

网络本地组管理员 postgres /add

5.) Add the postgres user to the Power Users group

5.) 将 postgres 用户添加到 Power Users 组

net localgroup "power users" postgres /add

网络本地组“高级用户” postgres /add

6.) Run a command window as the postgres user:

6.) 以 postgres 用户身份运行命令窗口:

runas /user:postgres cmd.exe

runas /user:postgres cmd.exe

7.) Change user postgres and install postgresql

7.) 更改用户 postgres 并安装 postgresql

8.)Back your and remove the postgres user from the Administrators group.

8.) 支持您并从管理员组中删除 postgres 用户。

net localgroup administrators postgres /delete

网络本地组管理员 postgres /delete

回答by David

I had the same error ("Failed to load SQL modules into the database cluster.") when installing on W2K12R2 using the EnterpriseDB installer linked to from the PostgreSQL Windows download page. I tried running the installer with admin privs, and using the postgres-user solution offered by Jeff G, but neither worked. Finally I tried the second installer, BigSQL, and that installed without issue.

使用从 PostgreSQL Windows 下载页面链接到的 EnterpriseDB 安装程序在 W2K12R2 上安装时,我遇到了同样的错误(“无法将 SQL 模块加载到数据库集群中。”)。我尝试使用管理员权限运行安装程序,并使用 Jeff G 提供的 postgres-user 解决方案,但都没有奏效。最后我尝试了第二个安装程序BigSQL,并且安装没有问题。

回答by DanB

  • Changed the data directory to something other than the installation directory of postgres
  • 将数据目录更改为 postgres 安装目录以外的其他目录

Make sure NETWORK SERVICEhas read/write permissions on that folder, the installation was failing for me until I did this.

确保NETWORK SERVICE对该文件夹具有读/写权限,在我这样做之前安装对我来说失败了。

回答by Peter Meier

I had this issue too with 9.5 and got around it by:

我在 9.5 中也遇到了这个问题,并通过以下方式解决了这个问题:

  1. Installing with the default data folder.
  2. Making sure my new data folder had full control access for the "NETWORK SERVICE" account.
  3. Then changing the default PGDATA folder as per this instruction: https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows
  1. 使用默认数据文件夹安装。
  2. 确保我的新数据文件夹对“NETWORK SERVICE”帐户具有完全控制访问权限。
  3. 然后按照此说明更改默认的 PGDATA 文件夹:https: //wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows

回答by Adrian Carr

I had the same problem, and noticed that some Postgres .bat files were opening in a text editor. Text editors opening files during installation isn't too uncommon, but I noticed these batch files were setting directory permissions. I then found that .bat files were set to open in a text editor (Notepad++) by default. I changed the default program for .bat files, uninstalled Postgres, re-ran the installer, and it worked perfectly. Hope this helps.

我遇到了同样的问题,并注意到一些 Postgres .bat 文件在文本编辑器中打开。在安装过程中打开文件的文本编辑器并不少见,但我注意到这些批处理文件正在设置目录权限。然后我发现 .bat 文件默认设置为在文本编辑器(Notepad++)中打开。我更改了 .bat 文件的默认程序,卸载了 Postgres,重新运行了安装程序,它运行良好。希望这可以帮助。

回答by Roman Z

When installing PostgreSQL, do not use the following symbols in your database's admin password: %, <, and >.

当安装PostgreSQL的,不要在你的数据库的管理员密码,请使用以下符号:%<,和>

Bug report and problem solution here

Bug 报告和问题解决方案在这里