So my application was working fine for the last couple of months. Started working on releasing it on our app server, ran into this problem. At first I thought it was just an issue with the mix release. But later went back and discovered it is happening on my workstation in dev
env now too. This is the error that occurs as soon as the application starts:
error] MyXQL.Connection (#PID<0.498.0>) failed to connect: ** (DBConnection.ConnectionError) (/tmp/mysql.sock) no such file or directory - :enoent
It repeats this over and over. I have tried everything I can think of… and here is the weird part. I created a whole new phoenix app, copied over just the database configs and dependencies, then coded a single db query to display on the home page and it works fine!!!
The error doesn’t make sense either. I don’t understand why I am getting an error about a mysql socket when it is setup as a :tcp
connection – the database is on another host.
I’ve been pulling my hair out for almost two days on this and have made zero inroads in discovering anything at all as to why this is happening. This keeps up for much longer I’m going to get kicked in the rear by my boss and forced to use Java/Tomcat and JSP. For the love of God, please no!
This is my config/dev.exs
.
config :nai, Nai.Repo,
database: "db/dev.db",
priv: "priv/repo"
config :nai, Nai.Fish.Repo,
database: "NAI",
username: "xxx",
password: "xxx",
hostname: "appsnh",
port: 3305,
protocol: :tcp,
priv: "/dev/null",
#socket_options: [:inet6] (not with myxql)
stacktrace: true,
pool_size: 10,
show_sensitive_data_on_connection_error: true,
read_only: true
And my repo modules:
defmodule Nai.Repo do
use Ecto.Repo,
otp_app: :nai,
adapter: Ecto.Adapters.SQLite3
end
defmodule Nai.Fish.Repo do
use Ecto.Repo,
otp_app: :nai,
adapter: Ecto.Adapters.MyXQL,
read_only: true
end
For the most part I am using the most recent releases of all dependencies… snippet from my mix.exs
.
{:phoenix, "~> 1.6.0"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.8"},
{:ecto_sqlite3, "~> 0.8.0"},
#{:postgrex, ">= 0.0.0"},
{:myxql, "~> 0.6.2"},
Please help!