postgresql – 尝试创建数据库时出错 – Ecto – Phoenix

我在尝试创建数据库时遇到错误.我安装了postgres,我已经成功完成了一些测试项目.而且,我没有看到这个错误.任何帮助都会很棒:

错误:

~/Desktop/elixir/restore $mix ecto.create
** (Mix) The database for Restore.Repo couldn't be created: tcp connect: connection refused - :econnrefused

21:52:23.978 [error] GenServer #PID<0.150.0> terminating
** (Postgrex.Error) tcp connect: connection refused - :econnrefused
    (db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:623: Connection.enter_connect/5
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
我尝试运行mix ecto.create时遇到了同样的问题.
所以首先要确保你有postgres.建议使用brew来安装它.

brew安装postgres

使用brew服务来启动/停止postgresql,

创建一个数据库,

创建postgres超级用户,

可能你需要授予文件夹权限.

这些链接对我有用:

psql: FATAL: role “postgres” does not exist

psql: FATAL: database “<user>” does not exist

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...