【发布时间】:2018-11-11 08:07:19
【问题描述】:
我是 postgreSQL(和 SQL 顺便说一句)的新手。我正在尝试在本地连接到数据库。 所以这是我正在使用的命令:
create user adeyris;
alter user antoine with login;
alter user antoine with encrypted password '123';
alter user antoine with createdb;
create database cpf_ietest;
我现在离开 psql,像这样加载我的转储:
psql -h localhost -U antoine -d cpf_ietest -f /home/antoine/Downloads/cpf_ietest.sql
我被要求输入密码,我输入 123,然后我收到以下错误:
psql: FATAL: 用户“antoine”的密码验证失败
这是我的 pg_hba.conf 文件:
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
在第一个未注释的行中,我将“peer”修改为“md5”。 我在 Ubuntu 16.04 和 postgresql 9.5 上运行。
感谢您的帮助, 安托万
【问题讨论】: