2019年10月31日 星期四

【PostgreSQL】記錄一次psql: FATAL: Ident authentication failed for user "XXX" 錯誤訊息


角色已創好,卻無法登入
-bash-4.1$ psql -h localhost -U aaa mydb
psql: FATAL: Ident authentication failed for user "aaa"

修改pg_hba.conf參數
[root@rosalie-mysql01 ~]# vi /var/lib/pgsql/10/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local all all peer改trust
# IPv4 local connections:
host all all 127.0.0.1/32 ident改md5
# IPv6 local connections:
host all all ::1/128 identmd5
# Allow replication connections from localhost, by a user with the
# replication privilege.


修改好參數後重啟,再試登入成功
[root@rosalie-mysql01 ~]# service postgresql-10 restart
[root@rosalie-mysql01 ~]# su - postgres
-bash-4.1$ psql -h localhost -U aaa mydb
Password for user aaa:
psql (10.10)
Type "help" for help.

mydb=> \c
You are now connected to database "mydb" as user "aaa".

mydb=> \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
aaa | Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
reporting | Replication | {}

沒有留言:

張貼留言

【MYSQL】MYSQL的SYS表說明(版本8.0)

mysql> use sys Reading table information for completion of table and column names You can turn off this feature to get a quicker s...