我刚刚在EC2 AMI实例上安装了PostgreSQL 9.2服务器。但是,我无法从命令提示符连接到它。无法连接到ec2上的postgres
此外我看到/var/lib
中的两个目录:pgsql9
和pgsql92
。 pgsql92中的数据目录是空的,因此它看起来像pgsql9是正在使用的那个。
[[email protected] etc]# psql
Password:
psql: FATAL: password authentication failed for user "root"
[[email protected] etc]# sudo su - postgres
-bash-4.2$ psql
Password:
psql: FATAL: password authentication failed for user "postgres"
-bash-4.2$ psql -U postgres
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
-bash-4.2$
的pg_hba.conf
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident
的postgresql.conf
listen_addresses = '*'
可能重复[Postgresql:密码认证失败的用户“postgres”](http://stackoverflow.com/questions/7695962/postgresql-password-authentication-failed-for-user-postgres) –
试图从解决方案链接,但仍然得到相同的错误 – user2325154