Phoenix - Specify socket location
justinbkay opened this issue · 3 comments
I'm migrating from the MySQL driver to MyXQL driver on one of my phoenix apps. When I replace the driver and try running it in production, it complains about not being able to find the socket file.
(DBConnection.ConnectionError) no such file or directory "/tmp/mysql.sock"
Which makes sense as the default location for the socket on the production server is /var/lib/mysql/mysql.sock
My question is how is the best way to specify the socket location for the driver when it is being used in a Phoenix app.
Hi @justinbkay, you can set the socket by passing socket: "/var/lib/mysql/mysql.sock"
, see https://hexdocs.pm/myxql/MyXQL.html#start_link/1 for more information. So in a Phoenix app that uses Ecto, that would be:
config :myapp, MyApp.Repo,
...,
socket: "/var/lib/mysql/mysql.sock",
...
Thank you for the quick response!
I'm getting the same error, and can't figure out why. I am not even running on a socket. I set protocol: :tcp
and set a host and port.