如何重置Postgres密码



我使用wamp在Windows 10上,我添加了PostgreSQL和PhppGadmin,一切正常。今天,我无法通过phppgadmin或php_pdo Web应用程序登录到PostgreSQL。

我尝试在2个位置编辑pg_hba.conf c:PostgreSQLpg96initc:PostgreSQLdatapg96,并根据这里的许多答案将"方法"更改为trust,CLI答案也没有。

我还重新启动了" Wamp"甚至整个计算机,但没有运气。

默认密码在postgresroot之前工作,但现在不在。

我如何重置后键密码?

更新

运行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:PostgreSQLdatapg96" start使它运行。现在,我们将明天开始看看。...我想念我的Unix环境。

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

当上述代码工作时,它朝错误的方向移动。goto Control Panel->Administrative Tools->Services并在列表中找到" postgresql ..."。右键单击并打开属性。

我的Startup type:设置为'自动',但它没有启动,我将其设置为'自动(延迟启动)',现在它可以自动工作!

相关内容

最新更新