无法混合ecto.create。多个错误

时间:2016-08-17 09:49:07

标签: postgresql elixir phoenix-framework ecto mix

尝试运行mix ecto.create时出现以下错误:

  1. .Repo couldn't be created: tcp connect: connection refused - :econnrefused
  2. .Repo couldn't be created: FATAL (invalid_authorization_specification): role "postgres" does not exist
  3. .Repo couldn't be created: FATAL (invalid_authorization_specification): role "postgres" is not permitted to log in
  4. 为了正确设置凤凰城,Postgres必须满足哪些条件?

2 个答案:

答案 0 :(得分:3)

要运行mix ecto.create,您需要一系列条件:

  1. Postgres必须启动并运行。

  2. Postgres的用户必须postgres,密码为postgres

  3. postgres用户必须拥有登录 CREATEDB 的权限。

  4. 例如,我在本地运行Postgres但却错过了postgres用户。

    所以在PSQL内我必须使用以下命令:

    # CREATE ROLE postgres LOGIN CREATEDB PASSWORD 'postgres';
    

    然后它奏效了。

    感谢Wendy Smoak

答案 1 :(得分:0)

  1. 开始你的postgres :(假设你使用的是mac)

    pg_ctl -D / usr / local / var / postgres -l /usr/local/var/postgres/server.log start

  2. 然后您可以在cofig / dev.exs中更改底部的数据库配置,以使用您的帐户和能够创建数据库的角色。