Why postgresql on mac asks me for password after fresh install?

后端 未结 3 1745
后悔当初
后悔当初 2021-01-02 19:21

I just installed postgresql on a Macbook with brew install postgresql. Then I try to psql, but it requires password and then show

3条回答
  •  萌比男神i
    2021-01-02 19:55

    So your username probably does not exist, as the default username that ships with the db is postgres.

    Further, I was prevented from the submission of an empty password, which is blank by default for the postgres user.

    You might try

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

    and then to use

    psql -U postgres
    password: postgres
    

    I'm not 100% sure of which SO answer I got this from, perhaps here. Hope this helps.

提交回复
热议问题