theo09

theo09

Ecto create a repo error

I wish to use Ecto for a project but when I realize the command mix ecto.create I have the following error Invalid Elixir version requirement in mix.exs file. However, I have the same version in this file as that at present used. I tried with of other one versions but the error is always present. Can you help me?

Most Liked

garthk

garthk

config :my_app, MyApp.Repo,
  # Help diagnose connection errors:
  show_sensitive_data_on_connection_error: true
NobbZ

NobbZ

Usually asdf is installed “per user”, so I assume that root won’t even see the asdf script/function (however its implemented).

NobbZ

NobbZ

Oh, and you will probably need to sudo rm -rf _build deps before using mix without sudo again to “repair” ownerships and permissions.

kokolegorille

kokolegorille

You should check your credentials. It is located in the config folder of your farmbot application.

You should match that the user specified is allowed to use database.

In case not… You might look at https://www.postgresql.org/docs/9.5/static/sql-createuser.html

Aetherus

Aetherus

I’m using ecto with mariadb (Mariaex) in a non-Phoenix app. This is my database config:

# config/config.exs
config :iocp_monitor, ecto_repos: [IocpMonitor.Repo]

config :iocp_monitor, IocpMonitor.Repo,
    database: "iocp",
    username: "root",
    password: "1q2w3e4r5t",
    hostname: "localhost",
    port: "3306",
    migration_timestamps: [type: :utc_datetime]

And this is my repo definition:

defmodule IocpMonitor.Repo do
  use Ecto.Repo,
    otp_app: :iocp_monitor,
    adapter: Ecto.Adapters.MySQL
end

When I run mix ecto.create and mix ecto.migrate, they finished successfully, and I can see the new database and the new tables in it, so I suppose the database connection configuration is correct. But when I try to start my otp app, this happens:

13:22:08.399 [error] GenServer #PID<0.421.0> terminating
** (RuntimeError) connect raised ArgumentError exception.The exception details are hidden, as they may contain sensitive data such as database credentials. You may set :show_sensitive_data_on_connection_error to true if you wish to see all of the details
    :erlang.byte_size/1
    (mariaex) lib/mariaex/messages.ex:103: Mariaex.Messages.encode_handshake_resp/1
    (mariaex) lib/mariaex/messages.ex:219: Mariaex.Messages.encode/2
    (mariaex) lib/mariaex/protocol.ex:1156: Mariaex.Protocol.msg_send/3
    (mariaex) lib/mariaex/protocol.ex:218: Mariaex.Protocol.handle_handshake/3
    (mariaex) lib/mariaex/protocol.ex:171: Mariaex.Protocol.handshake_recv/2
    (db_connection) lib/db_connection/connection.ex:66: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
Last message: nil
State: Mariaex.Protocol

I have no idea why it fails, and I don’t know where to add the configuration :show_sensitive_data_on_connection_error. Can anyone help? Thanks in advance.

Where Next?

Popular in Questions Top

JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New

Other popular topics Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement