如何重置postgres密码
How to reset postgres password
我在 Windows 10 使用 WAMP,我添加了 PostgreSQL 和 PhpPgAdmin,一切正常。今天我无法通过 PhpPgAdmin 或 php_pdo 网络应用程序登录 PostgreSQL。
我尝试在 c:\PostgreSQL\pg96\init\
和 c:\PostgreSQL\data\pg96\
两个位置编辑 pg_hba.conf
,并根据许多答案 here 将 'method' 更改为 trust
, none 的 CLI 答案也有效。
我也重启了 "WAMP" 甚至整台电脑,但是没有成功。
默认密码在 postgres
和 root
之前有效,但现在无效。
如何重置 postgre 密码?
更新
正在运行 psql -U postgres
returns;
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 ...'。右键单击并打开属性。
我的 Startup type:
设置为“自动”但它没有启动,我将其设置为“自动(延迟启动)' 现在它自动运行了!
我在 Windows 10 使用 WAMP,我添加了 PostgreSQL 和 PhpPgAdmin,一切正常。今天我无法通过 PhpPgAdmin 或 php_pdo 网络应用程序登录 PostgreSQL。
我尝试在 c:\PostgreSQL\pg96\init\
和 c:\PostgreSQL\data\pg96\
两个位置编辑 pg_hba.conf
,并根据许多答案 here 将 'method' 更改为 trust
, none 的 CLI 答案也有效。
我也重启了 "WAMP" 甚至整台电脑,但是没有成功。
默认密码在 postgres
和 root
之前有效,但现在无效。
如何重置 postgre 密码?
更新
正在运行 psql -U postgres
returns;
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 ...'。右键单击并打开属性。
我的 Startup type:
设置为“自动”但它没有启动,我将其设置为“自动(延迟启动)' 现在它自动运行了!