2017-10-17 40 views
1

我剛剛在brew install postgresql的Macbook上安裝了postgresql。然後我嘗試psql,但它需要密碼,然後顯示psql: FATAL: password authentication failed for user "<myname>"爲什麼mac上的postgresql在全新安裝後問我密碼?

我還沒有設置任何東西,並輸入我的mac密碼什麼都不做。我現在應該怎麼做?

+0

hm。對於本地主機,它應該默認使用同級身份驗證,而不是md5 ...'pg_hba.conf'中的內容?(''sudo find/-name pg_hba.conf') –

回答

0

因此,您的用戶名可能不存在,因爲隨db提供的默認用戶名是postgres

此外,我無法提交空密碼,默認情況下,該密碼爲postgres用戶。

你可以嘗試

cd ~/ 
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" 
Password: YOUR_LOGIN_PWD_HERE (required for sudo) 

,然後使用

psql -U postgres 
password: postgres 

我不肯定這100%的SO回答我得到這個從,也許here。希望這可以幫助。

相關問題