database PostgreSQL 数据库服务

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

PostgreSQL database service

windowsdatabasepostgresql

提问by Dejell

I downloaded PostgreSQL from their site - http://www.postgresql.org/download/windows

我从他们的网站下载了 PostgreSQL - http://www.postgresql.org/download/windows

However, I can't create a database from pgAdminand get a message:

但是,我无法从pgAdmin创建数据库并收到一条消息:

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?

无法连接到服务器:连接被拒绝 (0x0000274D/10061) 服务器是否在主机“localhost”上运行并接受端口 5432 上的 TCP/IP 连接?无法连接到服务器:连接被拒绝 (0x0000274D/10061) 服务器是否在主机“localhost”上运行并接受端口 5432 上的 TCP/IP 连接?

Do I have to create a windows service? How is it called? Do I have to install it separately?

我必须创建 Windows 服务吗?怎么称呼?我必须单独安装吗?

EDITED

已编辑

Let me explain myself. I am trying to run the service. I tried running postgres.exe from the command line but still it does not run.

让我解释一下自己。我正在尝试运行该服务。我尝试从命令行运行 postgres.exe,但它仍然无法运行。

What could run the database?

什么可以运行数据库?

EDITED

已编辑

The problem was with my installation file. I downloaded it again - and it worked well!

问题出在我的安装文件上。我再次下载了它 - 它运行良好!

回答by ontrack

Use services (start -> run -> services.msc) and look for the postgresql-[version] service.

使用服务(开始 -> 运行 -> services.msc)并查找 postgresql-[version] 服务。

  • If it is not there you might have just installed pgAdmin and not installed PostgreSQL itself.
  • If it is not running try to start it, if it won't start open the event-viewer (start -> run -> eventvwr) and look for error messages relating to the PostgreSQL service.
  • If it does start check the startup type, if you want it to start with windows it should be "Automatic"; or perhaps "Automatic, delayed start" if you don't want it to slow down startup too much.
  • 如果它不存在,您可能刚刚安装了 pgAdmin 而没有安装 PostgreSQL 本身。
  • 如果它没有运行,请尝试启动它,如果它不会启动,请打开事件查看器(开始 -> 运行 -> eventvwr)并查找与 PostgreSQL 服务相关的错误消息。
  • 如果它确实开始检查启动类型,如果你希望它从 Windows 启动它应该是“自动”;或者,如果您不想让启动速度减慢太多,也可以选择“自动延迟启动”。


Adding to the first, because in a different comment you've said the service isn't there. It is possible to download a standalone pgAdmin so you can connect to an external PostgreSQL database. It would seem you have done such a thing, or explicitly chosen to not add the service. Just try the One Click Installer, which still allows proper configuration of installation directory despite its name.

添加到第一个,因为在不同的评论中,您已经说过该服务不存在。可以下载独立的 pgAdmin,以便您可以连接到外部 PostgreSQL 数据库。看起来您已经做了这样的事情,或者明确选择不添加该服务。只需尝试One Click Installer,尽管它的名称仍然允许正确配置安装目录。

回答by Ahmad Abdelghany

You might get a more descriptive error message if you tried to start the service from command line using this command:

如果您尝试使用以下命令从命令行启动服务,您可能会收到更具描述性的错误消息:

"C:\Program Files\PostgreSQL.5\bin\pg_ctl.exe" start -N "postgresql-x64-9.5" 
  -D "C:\Program Files\PostgreSQL.5\data" -w

The log file would be at C:\Program Files\PostgreSQL\9.5\data\pg_log. Note that paths and service name might be different depending on your installation.

日志文件将在C:\Program Files\PostgreSQL\9.5\data\pg_log. 请注意,路径和服务名称可能因您的安装而异。

回答by Anaurg

(start -> run -> services.msc) and look for the postgresql-[version] service then right click and enable it

(开始 -> 运行 -> services.msc)并查找 postgresql-[version] 服务,然后右键单击并启用它

回答by Jhon

I have the solution to this problem enters (Start -> Run -> services.msc) are looking for the postgresql service once you localizas le das Properties---> login and you disable the account you have and what you leave as the local system account , save and restart the programs pgadmin3 and ready should operate.

我有这个问题的解决方案进入(开始 - >运行 - > services.msc)正在寻找postgresql服务,一旦你本地化le das Properties--->登录并且你禁用你拥有的帐户以及你作为本地人留下的东西系统帐户,保存并重新启动程序 pgadmin3 并准备好运行。

Greeting from Colombia

来自哥伦比亚的问候

回答by Frank Liao

You only need to do

你只需要做

pg_ctl register

then execute servcies.msc

然后执行 servcies.msc

enable the "PostgresSQL" and set to auto

启用“PostgresSQL”并设置为自动

then, your postgresql will run like the "server".

然后,您的 postgresql 将像“服务器”一样运行。

回答by Ruslan

The solution was simply to comment the lines "work_mem=256MB" and "maintenance_work_mem=$3GB" in the file postgresql.conf and try to start the postgresql service. (start -> run -> services.msc) and look for the postgresql-[version] service then right click and start.

解决方案只是在文件 postgresql.conf 中注释“work_mem=256MB”和“maintenance_work_mem=$3GB”行并尝试启动 postgresql 服务。(开始 -> 运行 -> services.msc)并查找 postgresql-[version] 服务,然后右键单击并启动。

回答by Mesut ASARKAYA

Checking the port may work.

检查端口可能会起作用。

On pgAdmin page at the top, go to Properties and check the port if it is same with the one provided during the setup. If not click the edit button on the top right and change the port.

在顶部的 pgAdmin 页面上,转到“属性”并检查端口是否与设置期间提供的端口相同。如果没有,请单击右上角的编辑按钮并更改端口。

回答by Natacha

If you don't want or can't install postgres again, you can install the server from the binary zip like this postexplains it.

如果您不想或不能再次安装 postgres,您可以从二进制 zip 安装服务器,就像这篇文章解释的那样。

回答by YasirPoongadan

Please Download from this

请从这里下载

https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

install above downloaded file

安装上面下载的文件

then

然后

The solution was simply to delete %appdata%\pgAdmin (win key + r then type %appdata% got folder pgAdmin) which was created by an earlier version. On systems other than Windows, there probably is a pgAdmin directory in your user directory. Of course, all session settings etc. are gone after deleting this.

解决方案只是删除由早期版本创建的 %appdata%\pgAdmin (win key + r 然后键入 %appdata% got folder pgAdmin)。在 Windows 以外的系统上,您的用户目录中可能有一个 pgAdmin 目录。当然,删除此内容后,所有会话设置等都消失了。

回答by Bonshington

  1. check conenctionstring
  2. check SSL
  3. check firewall
  4. if u use VS studio, check for db driver
  1. 检查连接字符串
  2. 检查 SSL
  3. 检查防火墙
  4. 如果您使用 VS Studio,请检查数据库驱动程序