Error trying to create database - Ecto - Phoenix

I am trying to create a database on error. I have installed postgres, and I have already successfully completed several test projects. And I did not see this error. Any help would be great:

ERROR:

 ~/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
+4
source share
2 answers

I had the same problem today when you tried to run mix ecto.create. So first make sure you have postgres. It is recommended to use brew to install it.

brew install postgres

use brew services to start / stop postgresql,

create a database

create postgres superuser,

You will probably need to grant folder permissions.

:

psql: FATAL: role "postgres"

psql: FATAL: "<user> "

+7

, , postgres .

, , :

brew services list

, :

Name Status User Plist postgresql stopped

:

brew services start postgresql

!

+3

Source: https://habr.com/ru/post/1648316/


All Articles