cenotaph

cenotaph

MySQL on ubuntu + MyXQL connection refused issues nightmare

I am trying to build my phoenix app on my server and facing a nightmarish issue because of the major platform differences with my dev machine.

Server:

mysqld  Ver 5.7.33-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))

Error:

23:01:12.690 [error] MyXQL.Connection (#PID<0.382.0>) failed to connect: ** (DBConnection.ConnectionError) connection refused

very helpful! I know.

tried with ecto:// or mysql:// no luck. I have hardcoded the values into the config files still refused!

I know for a fact that MySQL is up and running, the user credentials are correct and verified several times. Scratching my head found this gem in the source code.

defmodule Ecto.Adapters.MyXQL do
  @moduledoc """
  Adapter module for MySQL.

  It uses `MyXQL` for communicating to the database.

  ## Options

  MySQL options split in different categories described
  below. All options can be given via the repository
  configuration:

  ### Connection options

    * `:protocol` - Set to `:socket` for using UNIX domain socket, or `:tcp` for TCP
      (default: `:socket`)
    * `:socket` - Connect to MySQL via UNIX sockets in the given path.

Would be useful if this was published in the hex docs but I can raise an issue for it later.

Although I am on unix for my dev machine and setup is completely different, it works with no problems.

so now I have hope! I pass in actual socket path with ecto://.....?socket=PATH still refused or mysql:// still refused

I have set the protocol still no luck

protocol: :tcp

I can’t really use iex -S because of the constant spamming of connection refused.

I see in the documentation about starting with the supervisor…

It's recommended to start MyXQL under supervision tree:

defmodule MyApp.Application do
  use Application

  def start(_type, _args) do
    children = [
      {MyXQL, username: "root", name: :myxql}
    ]

    Supervisor.start_link(children, opts)
  end
end

which made me go WTF! Because everything worked till now I didn’t realise this required a ‘boot’ config till now.

This is beyond F’ed level up of configuration at this point but let me try.

Oh connection refused for my user, it did work and have an affect.

change to protocol to tcp… nope

it expects a goddamn socket and then I realized I have two different errors from different processes.

23:29:45.463 [error] MyXQL.Connection (#PID<0.404.0>) failed to connect: ** (MyXQL.Error) (1045) (ER_ACCESS_DENIED_ERROR) Access denied for user 'test'@'localhost' (using password: NO)
23:29:45.520 [error] MyXQL.Connection (#PID<0.379.0>) failed to connect: ** (DBConnection.ConnectionError) connection refused

I hardcode the password and still, shoddy shit won’t connect.

      {MyXQL, username: "user", name: :myxql, socket: "/var/run/mysqld/mysqld.sock", password: "test", database: "test"}

I put all the values into the shoddy MyXQL supervisor tree and drop from config still refused.

Does anyone have any advice? Which bit am I missing here?

The only reason I am not using Postgres is the bigger footprint on the xxx-small server I have.

First Post!

kokolegorille

kokolegorille

That is an old version of mysqld… are You sure You are using the same authentication plugin between mysqld and myxql?

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
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
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
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
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
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement