Hi there, I’m new to elixir. I’m trying to create a simple phoenix app with MySQL connection.
I’m using everything default that comes from the bundle.
Whenever I try running the application, I get this error:
function Ecto.Adapters.MySQL.Connection.child_spec/1 is undefined or private
Here’s some more details of the error:
==> db_connection
Compiling 23 files (.ex)
Generated db_connection app
==> phoenix
Compiling 60 files (.ex)
Generated phoenix app
==> phoenix_live_reload
Compiling 3 files (.ex)
Generated phoenix_live_reload app
==> mariaex
Compiling 14 files (.ex)
Generated mariaex app
==> ecto
Compiling 64 files (.ex)
warning: undefined behaviour function handle_deallocate/4 (for behaviour DBConnection)
lib/ecto/adapters/sql/sandbox.ex:161
warning: undefined behaviour function handle_declare/4 (for behaviour DBConnection)
lib/ecto/adapters/sql/sandbox.ex:161
warning: undefined behaviour function handle_first/4 (for behaviour DBConnection)
lib/ecto/adapters/sql/sandbox.ex:161
warning: undefined behaviour function handle_next/4 (for behaviour DBConnection)
lib/ecto/adapters/sql/sandbox.ex:161
warning: undefined behaviour function ensure_all_started/2 (for behaviour DBConnection.Pool)
lib/ecto/adapters/sql/sandbox.ex:211
warning: unused import Ecto.Query.select/3
lib/ecto/association.ex:1
warning: undefined behaviour function child_spec/1 (for behaviour Ecto.Adapters.SQL.Connection)
lib/ecto/adapters/mysql/connection.ex:3
warning: undefined behaviour function execute/4 (for behaviour Ecto.Adapters.SQL.Connection)
lib/ecto/adapters/mysql/connection.ex:3
warning: undefined behaviour function prepare_execute/5 (for behaviour Ecto.Adapters.SQL.Connection)
lib/ecto/adapters/mysql/connection.ex:3
warning: function Mariaex.Connection.decode/2 is undefined or private
lib/ecto/adapters/mysql/connection.ex:28
warning: function Ecto.Adapters.Postgres.Connection.all/1 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Ecto.Adapters.Postgres.Connection.delete/4 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Ecto.Adapters.Postgres.Connection.delete_all/1 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Ecto.Adapters.Postgres.Connection.execute_ddl/1 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Ecto.Adapters.Postgres.Connection.insert/5 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Ecto.Adapters.Postgres.Connection.update/5 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Ecto.Adapters.Postgres.Connection.update_all/1 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:56
warning: function Postgrex.start_link/1 is undefined (module Postgrex is not available)
lib/ecto/adapters/postgres.ex:115
warning: function Ecto.Adapters.Postgres.Connection.execute/4 is undefined (module Ecto.Adapters.Postgres.Connection is not available)
lib/ecto/adapters/postgres.ex:117
Generated ecto app
==> phoenix_ecto
Compiling 4 files (.ex)
Generated phoenix_ecto app
==> elixir_conslogv1
Compiling 12 files (.ex)
Generated elixir_conslogv1 app
[info] Application elixir_conslogv1 exited: ElixirConslogv1.start(:normal, []) returned an error: shutdown: failed to start child: ElixirConslogv1.Repo
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Ecto.Adapters.MySQL.Connection.child_spec/1 is undefined or private
(ecto) Ecto.Adapters.MySQL.Connection.child_spec([name: ElixirConslogv1.Repo.Pool, otp_app: :elixir_conslogv1, repo: ElixirConslogv1.Repo, adapter: Ecto.Adapters.MySQL, username: "****", password: "****", database: "****", hostname: "localhost", pool_size: 10, pool_timeout: 5000, timeout: 15000, pool: DBConnection.Poolboy, adapter: Ecto.Adapters.MySQL, username: "****", password: "****", database: "****", hostname: "localhost", pool_size: 10])
(ecto) lib/ecto/repo/supervisor.ex:92: Ecto.Repo.Supervisor.init/1
(stdlib) supervisor.erl:294: :supervisor.init/1
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
[info] Application mariaex exited: :stopped
[info] Application db_connection exited: :stopped
[info] Application connection exited: :stopped
[info] Application phoenix_ecto exited: :stopped
[info] Application ecto exited: :stopped
[info] Application poolboy exited: :stopped
[info] Application decimal exited: :stopped
[info] Application cowboy exited: :stopped
[info] Application cowlib exited: :stopped
[info] Application ranch exited: :stopped
[info] Application phoenix_html exited: :stopped
[info] Application phoenix_pubsub exited: :stopped
=INFO REPORT==== 24-Nov-2016::19:31:09 ===
application: logger
exited: stopped
type: temporary
** (Mix) Could not start application elixir_conslogv1: ElixirConslogv1.start(:normal, []) returned an error: shutdown: failed to start child: ElixirConslogv1.Repo
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Ecto.Adapters.MySQL.Connection.child_spec/1 is undefined or private
(ecto) Ecto.Adapters.MySQL.Connection.child_spec([name: ElixirConslogv1.Repo.Pool, otp_app: :elixir_conslogv1, repo: ElixirConslogv1.Repo, adapter: Ecto.Adapters.MySQL, username: "root", password: "****", database: "****", hostname: "localhost", pool_size: 10, pool_timeout: 5000, timeout: 15000, pool: DBConnection.Poolboy, adapter: Ecto.Adapters.MySQL, username: "****", password: "****", database: "****", hostname: "localhost", pool_size: 10])
(ecto) lib/ecto/repo/supervisor.ex:92: Ecto.Repo.Supervisor.init/1
(stdlib) supervisor.erl:294: :supervisor.init/1
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
I’ve searched for a similar problem and from what I see, it seems that ecto 3.0 is apparently incompatible with mysql, but I can’t be sure.
Here’s how my deps look like:
defp deps do
[{:phoenix, "~> 1.2.1"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.0"},
{:mariaex, ">= 0.0.0"},
{:phoenix_html, "~> 2.6"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"}]
end```
Any ideas?