postgresql - 如何重置postgres密码

标签 postgresql wamp

我在 Windows 10 上使用 WAMP,我添加了 PostgreSQL 和 PhpPgAdmin,一切正常。今天我无法通过 PhpPgAdmin 或 php_pdo 网络应用程序登录 PostgreSQL。

我尝试在 2 个位置编辑 pg_hba.conf c:\PostgreSQL\pg96\init\c:\PostgreSQL\data\pg96\ 并根据许多答案将“方法”更改为 trust here ,所有 CLI 答案均无效。

我还重新启动了“WAMP”甚至整个计算机,但没有成功。

默认密码在 postgresroot 之前有效,但现在无效。

如何重置 postgre 密码?

更新

运行 psql -U postgres 返回;

psql: 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?

pg_hba.conf 的内容

# TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD

# IPv4 local & remote connections:
host    all             all             127.0.0.1/32            trust
host    all             all             0.0.0.0/0               trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

最佳答案

所以经过更多的挖掘,并不是密码错误,而是出于某种原因,PostgreSQL 甚至没有运行。 Windows 就是这样一个 PITA!

最后,从 CMD 运行 pg_ctl -D "C:\PostgreSQL\data\pg96"start 就可以了。现在我们看看它明天是否开​​始......我想念我的 Unix 环境。

-----更新-----

虽然上面的代码有效,但它的方向是错误的。 转到 Control Panel->Administrative Tools->Services 并在列表中找到“PostgreSQL ...”。右键单击并打开“属性”。

我的启动类型:设置为“自动”但它没有启动,我将其设置为“自动(延迟启动)” ' 现在它可以自动运行了!

关于postgresql - 如何重置postgres密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46223116/

相关文章:

sql - node.js - 如何将 json 数组中的值插入到 sql 数据库中

sql - 分组依据以及子句外部的列

java - COPY FROM 和 Postgres 中的 C3PO 连接池

php - 用于 wampserver 2.4 的 APC

php - WAMP 错误 - #1045 无法登录 MySQL 服务器

postgresql - 奇怪的 now() 与 Postgres 触发器的时差

django - 如何在 postgresql 或 mongodb 中使用 quandl Python API/模块存储来自 quandl 的数据集和数据库?

mysql - 打开 phpMyAdmin 时访问被拒绝

wamp - 如何在 localhost 中模拟低带宽(网络延迟)(在 WAMP、Windows XP 上运行)?

php - 在wamp上使用php从mysql数据库中随机选择