initdb: error: could not create directory “./PostgreSQL”: Permission denied
initdb: error: could not create directory “./PostgreSQL”: Permission denied
这是我第一次在 windows 8.1
上设置数据库 (postgresql 12)
从这个领域的许多相关问题中努力寻找解决方案已经 4 天了,但没有成功找到答案(无论是我不理解它们还是它们对我的情况不起作用)。
所以,在这里,我将逐步解释我在每个阶段做了什么以及我遇到了什么错误(它们可能不会相互影响,但我会提到所有错误):
当我以管理员身份安装 PostgreSQL 时,在过程结束时出现此错误:“无法将 SQL 模块加载到数据库集群中” 我重新安装了两次,但似乎每次弹出。在这里,在这个 post 中,我发现有人面临同样的问题,但我在技术上不明白解决方案是什么,不幸的是:Failed to load sql modules into the database cluster during PostgreSQL 安装。因此,我只是跳过它,一切似乎都还好。
然后我在高级系统设置中设置PATH-->环境变量(在用户变量和系统变量框中)如下:“;C:\Program Files\PostgreSQL\bin;C:\Program Files\PostgreSQL\lib"
完成这一步后,我使用 ctrl+R 打开终端并输入 cmd.exe 然后输入这些代码:
> cd C:\Program Files\PostgreSQL\bin
> initdb -U postgres -A password -E utf8 -W -D .\PostgreSQL\data
我收到这条消息:
The files belonging to this database system will be owned by user "pc".
This user must also own the server process.
The database cluster will be initialized with locale "English_United States.1252".
The default text search configuration will be set to "english".
Data page checksums are disabled.
Enter new superuser password:
Enter it again:
输入密码后,出现此错误:
The files belonging to this database system will be owned by user "pc".
This user must also own the server process.
The database cluster will be initialized with locale "English_United
States.1252".
The default text search configuration will be set to "english".
Data page checksums are disabled.
Enter new superuser password:
Enter it again:
creating directory /PostgreSQL/12/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... windows
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Tehran
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D ^"^\PostgreSQL^^\data^" -l logfile start
但是当输入建议的代码时(无论使用日志文件还是其他文件名),我不断收到此消息:
waiting for server to start....Access is denied.
stopped waiting
pg_ctl: could not start server
Examine the log output.
另一方面,当我尝试 pgAdmin4 浏览器界面时,当我右键单击服务器-->创建-->弹出的服务器时 window 我填写了这些字段:
在“常规”选项卡上,我将“名称”框填写为“dbserver”,我的“用户名”设置为“postgres”,然后在“连接”选项卡上,我将“主机”设置为“本地主机”和“密码”和我之前设置的一样。
这是我得到的错误:
Unable to connect to server: could not connect to server: Connection refused (0x0000274D/10061) Is
the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not
connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost"
(127.0.0.1) and accepting TCP/IP connections on port 5432?
有人可以帮我解决这个问题吗?
谢谢
所以,我找到了答案,我想分享它。我打开 postgres.conf 文件并注释掉 logging_collector、log_directory 和 log_destination。我保存了文件。
然后在终端中,我输入了如下建议的代码:
pg_ctl -D ^"^\PostgreSQL^^\data^" start
服务器启动。
现在在 pgAdmin4 浏览器中,问题也消失了。
这是我第一次在 windows 8.1
上设置数据库 (postgresql 12)从这个领域的许多相关问题中努力寻找解决方案已经 4 天了,但没有成功找到答案(无论是我不理解它们还是它们对我的情况不起作用)。
所以,在这里,我将逐步解释我在每个阶段做了什么以及我遇到了什么错误(它们可能不会相互影响,但我会提到所有错误):
当我以管理员身份安装 PostgreSQL 时,在过程结束时出现此错误:“无法将 SQL 模块加载到数据库集群中” 我重新安装了两次,但似乎每次弹出。在这里,在这个 post 中,我发现有人面临同样的问题,但我在技术上不明白解决方案是什么,不幸的是:Failed to load sql modules into the database cluster during PostgreSQL 安装。因此,我只是跳过它,一切似乎都还好。
然后我在高级系统设置中设置PATH-->环境变量(在用户变量和系统变量框中)如下:“;C:\Program Files\PostgreSQL\bin;C:\Program Files\PostgreSQL\lib"
完成这一步后,我使用 ctrl+R 打开终端并输入 cmd.exe 然后输入这些代码:
> cd C:\Program Files\PostgreSQL\bin
> initdb -U postgres -A password -E utf8 -W -D .\PostgreSQL\data
我收到这条消息:
The files belonging to this database system will be owned by user "pc".
This user must also own the server process.
The database cluster will be initialized with locale "English_United States.1252".
The default text search configuration will be set to "english".
Data page checksums are disabled.
Enter new superuser password:
Enter it again:
输入密码后,出现此错误:
The files belonging to this database system will be owned by user "pc".
This user must also own the server process.
The database cluster will be initialized with locale "English_United
States.1252".
The default text search configuration will be set to "english".
Data page checksums are disabled.
Enter new superuser password:
Enter it again:
creating directory /PostgreSQL/12/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... windows
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Tehran
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D ^"^\PostgreSQL^^\data^" -l logfile start
但是当输入建议的代码时(无论使用日志文件还是其他文件名),我不断收到此消息:
waiting for server to start....Access is denied.
stopped waiting
pg_ctl: could not start server
Examine the log output.
另一方面,当我尝试 pgAdmin4 浏览器界面时,当我右键单击服务器-->创建-->弹出的服务器时 window 我填写了这些字段:
在“常规”选项卡上,我将“名称”框填写为“dbserver”,我的“用户名”设置为“postgres”,然后在“连接”选项卡上,我将“主机”设置为“本地主机”和“密码”和我之前设置的一样。
这是我得到的错误:
Unable to connect to server: could not connect to server: Connection refused (0x0000274D/10061) Is
the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not
connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost"
(127.0.0.1) and accepting TCP/IP connections on port 5432?
有人可以帮我解决这个问题吗?
谢谢
所以,我找到了答案,我想分享它。我打开 postgres.conf 文件并注释掉 logging_collector、log_directory 和 log_destination。我保存了文件。
然后在终端中,我输入了如下建议的代码:
pg_ctl -D ^"^\PostgreSQL^^\data^" start
服务器启动。
现在在 pgAdmin4 浏览器中,问题也消失了。