尝试运行mix ecto.create
时出现以下错误:
.Repo couldn't be created: tcp connect: connection refused - :econnrefused
.Repo couldn't be created: FATAL (invalid_authorization_specification): role "postgres" does not exist
.Repo couldn't be created: FATAL (invalid_authorization_specification): role "postgres" is not permitted to log in
为了正确设置凤凰城,Postgres必须满足哪些条件?
答案 0 :(得分:3)
要运行mix ecto.create
,您需要一系列条件:
Postgres必须启动并运行。
Postgres的用户必须postgres
,密码为postgres
。
postgres
用户必须拥有登录和 CREATEDB 的权限。
例如,我在本地运行Postgres但却错过了postgres
用户。
所以在PSQL内我必须使用以下命令:
# CREATE ROLE postgres LOGIN CREATEDB PASSWORD 'postgres';
然后它奏效了。
感谢Wendy Smoak。
答案 1 :(得分:0)
开始你的postgres :(假设你使用的是mac)
pg_ctl -D / usr / local / var / postgres -l /usr/local/var/postgres/server.log start
然后您可以在cofig / dev.exs中更改底部的数据库配置,以使用您的帐户和能够创建数据库的角色。