在没有安装的情况下在Windows中启动postgresql和pgadmin [英] starting postgresql and pgadmin in windows without installation
问题描述
如何在未安装Windows的情况下启动PostgreSQL和pgAdmin III。我在系统中没有管理员权限。所以我需要在不安装的情况下启动应用程序。我该怎么做?
How can I start PostgreSQL and pgAdmin III in windows without installation. I do not have admin rights in a system. so I need to start the application without installing . How can I do that?
推荐答案
- 从 https://www.enterprisedb.com/products-services-training/pgbindownload
- 将归档文件解压缩到您选择的目录中(创建归档文件以将其解压缩,它将创建目录
pgsql
及其下面的所有其他内容) -
运行
initdb
(可以在pgsql\bin $ c子目录中找到$ c>)
- Download the ZIP file from https://www.enterprisedb.com/products-services-training/pgbindownload
- Unzip the archive into a directory of your choice (the archive is created such that unzipping it, it will create a directory
pgsql
with everything else below that) Run
initdb
(this can be found in the subdirectorypgsql\bin
)
initdb -D c:\Users\Arthur\pgdata -U postgres -W -E UTF8 -A scram-sha-256
这将创建postgres数据目录(也称为集群 )在 c:\Users\Arthur\pgdata
中。您需要确保运行此命令的用户对该目录具有完全的读/写权限。
This will create the postgres "data directory" (aka the "cluster") in c:\Users\Arthur\pgdata
. You need to make sure that the user running this command has full read/write privileges on that directory.
-U postgres
将超级用户创建为 postgres
, -W
将提示您输入超级用户的密码 -E UTF8
将使用 UTF-8
编码和 -A md5
>启用密码认证。
-U postgres
creates the superuser as postgres
, -W
will prompt you for the password of the superuser, -E UTF8
will create the database with UTF-8
encoding and -A md5
enables the password authentication.
要启动Postgres,请运行:
To start Postgres, run:
pg_ctl -D c:\Users\Arthur\pgdata start
此< (!)必须作为运行 initdb
的用户来完成,以避免访问数据目录时出现任何问题。
this has(!) to be done as the user who ran initdb
to avoid any problems with the access to the data directory.
要关闭Postgres,运行:
To shutdown Postgres, run:
pg_ctl -D c:\Users\Arthur\pgdata stop
psql.exe
(命令行客户端)位于 bin
目录中。从Postgres 9.6开始,pgAdmin可执行文件 pgAdmin4.exe
位于子目录 pgAdmin 4\bin
。
psql.exe
(the command line client) is located in the bin
directory. Starting with Postgres 9.6 the pgAdmin executable pgAdmin4.exe
is located in the sub-directory "pgAdmin 4\bin"
.
(可选)创建Windows服务以自动运行Postgres(必须使用Windows管理员帐户运行)
Optionally create a Windows service to automatically run Postgres (must be run using a Windows administrator account)
pg_ctl register -N postgresql -D c:\Users\Arthur\pgdata stop
这篇关于在没有安装的情况下在Windows中启动postgresql和pgadmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!