首页 文章

Ecto Postgres安装错误密码验证失败

提问于
浏览
19

我使用数字海洋从你好的例子中创建了一个凤凰项目 . 我输入了etc / motd.tail文件中的用户名和密码 . 我一直收到以下错误消息 . 我是初学者,由于某种原因,我无法正确安装ecto .

**(混合)无法创建Hello.Repo的数据库,原因如下:psql:FATAL:用户“elixir”的密码验证失败致命:用户“elixir”的密码验证失败

您可以使用以下Postgress数据库凭据:用户:elixir 通行证:*

安装 . 任何帮助,将不胜感激 .

4 回答

  • 7

    我假设 mix ecto.create 任务发生了这个错误?

    发生这种情况是因为Ecto使用 psql 来创建数据库,但是在即将到来的Ecto 2.0中不再是这种情况 .

    以下GitHub问题显示相同的问题https://github.com/elixir-lang/ecto/issues/1207

    修复的相关评论是https://github.com/elixir-lang/ecto/issues/1207#issuecomment-172570064

    我的数据库配置(pg_hba.conf)显然是错误的 . 对于遇到此问题的任何其他人:主机所有my_user 127.0.0.1/32信任将无法工作主机所有my_user localhost信任将工作

    请检查 pg_hba.conf (可能在 /etc/postsgresql/9.x/pg_hba.conf ) .

  • 0

    我使用Ubuntu 14.04得到了同样的错误,我纠正了重置'postgres'密码:

    $ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
    

    并重新启动postgres服务:

    sudo service postgresql restart
    
  • 54

    我们只需要根据 config 文件夹中的文件使用this db method创建一个新的postgresql usernamepassword

    $ sudo -u postgres createuser <username>
    $ sudo -u postgres createdb <dbname>
    $ sudo -u postgres psql
    psql=# alter user <username> with encrypted password '<password>';
    psql=# grant all privileges on database <dbname> to <username> ;
    
  • 1

    我需要更新pg_hba.conf以使其工作 .

    我正在使用Fedora,所以转到/ var / lib / pgsql / data

    # "local" is for Unix domain socket connections only
    local   all             postgres                                peer
    local   all             all                                     md5
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    # IPv6 local connections:
    host    all             all             ::1/128                 ident
    

    然后我在postgres中创建了一个具有数据库创建功能的elixir用户,并在dev.exs中配置它(用户/密码/数据库)

相关问题