3

When trying to run mix ecto.create I got the following errors:

  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

What are the conditions that Postgres must meet in order to properly setup Phoenix?

4

2 回答 2

3

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

  1. Postgres 必须启动并运行。

  2. Postgres 必须有一个postgres具有密码的用户postgres

  3. postgres用户必须同时拥有LOGINCREATEDB的权限。

例如,我让 Postgres 在本地运行,但缺少postgres用户。

所以在PSQL中我不得不使用以下命令:

# CREATE ROLE postgres LOGIN CREATEDB PASSWORD 'postgres';

然后它起作用了。

温迪·斯莫克致敬

于 2016-08-17T09:49:06.803 回答
0
  1. 启动你的 postgres:(假设你使用的是 mac)

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

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

于 2016-08-18T04:30:45.287 回答