I have to manually create Postgressql DB?

Hey Guys,

I am following this tutorial and I noticed that when I run mix ecto.create I get an error. This has happened last time too. My solution to fix it is by going into a new terminal opening PSQL and creating the database manually. If I do run the command I get a Gen Server Error. Does anyone know why the command is not working for me?

Hello!

Maybe you forgot to set up config/dev.exs so that mix ecto.create knows where to find your DB server?

That’s what the tutorial says:

Then configure your database in config/dev.exs and run…

You may need to check the proper user, password, port, etc., to connect to your DB.

This command mix ecto.create will create a default DB with default username and password?

Hey @shansiddiqui94. Any time you make a forum post about an error, please include the full error in the post.

1 Like

This command will create the DB as configured on the environment you’re running it from. If you’re in dev environment as I suppose, take a look at config/dev.exs, it contains this for a recently generated Phoenix 1.6 app but you should change it to your DB setup:

config :example, Example.Repo,
  username: "postgres",
  password: "postgres",
  database: "example_dev",
  hostname: "localhost",
  show_sensitive_data_on_connection_error: true,
  pool_size: 10

Dully noted, I recognized the problem which is why I fixed it. If it happens again going forward I will Post the Error and follow up.