如何在Phoenix 框架中为命令指定自定义服务器端口?mix ecto.create
我使用命令创建了一个入门项目mix phx.new hello。hello\config\dev.exs我在路径中配置数据库如下,
config :hello, Hello.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "hello_dev",
show_sensitive_data_on_connection_error: true,
pool_size: 10
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用该命令配置Postgres 数据库mix ecto.create时,出现以下错误。
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
Run Code Online (Sandbox Code Playgroud)
我使用5433作为 Postgres 端口(注意:它适用于我的 spring java 项目),因为默认端口 5432 在我的本地不可用。
所以在hello\deps\ecto_sql\lib\ecto\adapters\postgres\connection.ex路径中我定义了路径中的默认端口,如下所示,
@default_port 5433
Run Code Online (Sandbox Code Playgroud)
但如果我再次运行该命令,它仍然尝试连接到 5432。
如何获取连接到 5433而不是 5432 的命令?