简体   繁体   中英

I am not able to connect to mySql db in elixir when i run mix ecto.create

I have replaced the postgrex dependency with {:myxql, ">= 0.0.0"} and now I"m getting this error:

** (MatchError) no match of right hand side value: {:error, {:postgrex, {'no such file or directory', 'postgrex.app'}}}
    (ecto_sql 3.8.3) lib/ecto/adapters/postgres.ex:308: Ecto.Adapters.Postgres.run_query/2
    (ecto_sql 3.8.3) lib/ecto/adapters/postgres.ex:159: Ecto.Adapters.Postgres.storage_up/1
    (ecto 3.8.4) lib/mix/tasks/ecto.create.ex:53: anonymous fn/3 in Mix.Tasks.Ecto.Create.run/1
    (elixir 1.13.4) lib/enum.ex:937: Enum."-each/2-lists^foreach/1-0-"/2
    (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.4) lib/mix/cli.ex:84: Mix.CLI.run_task/2

You should use the right adapter for your Repo.

Your application is still trying to use the Ecto.Adapters.Postgres adapter that was the default when you generated the app.
In your lib/app/repo.ex , change the adapter to Ecto.Adapters.MyXQL .

You can find documentation related to Ecto SQL adapters here : https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM