54
我無法連接到我自己的本地服務器上的postgres數據庫。 我GOOGLE了一些類似的問題,本手冊 https://help.ubuntu.com/stable/serverguide/postgresql.htmlPostgreSQL:角色不允許登錄
所以想出了:
pg_hba.conf
說:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 trust
然後我創建了一個用戶並分配給它一個密碼:
postgres=# create role asunotest;
CREATE ROLE
postgres=# alter role asunotest with encrypted password '1234';
ALTER ROLE
但它不讓我在:
-bash-4.2$ psql -h 127.0.0.1 -U asunotest
Password for user asunotest: 1234
psql: FATAL: role "asunotest" is not permitted to log in
可能是什麼問題?
正如我不能'psql',我怎麼能ALTER作用? –
@ RomulusUrakagiTs'ai你應該輸入一個postgres用戶(sudo -u postgres psql postgres) –