elixir-ecto / myxql

MySQL 5.5+ driver for Elixir
Apache License 2.0
273 stars 67 forks source link

Can't connect through SSH tunnel #161

Closed the-noob closed 1 year ago

the-noob commented 1 year ago

Using WSL, I've added a port forwarding to my SSH connection and connection works from a GUI (HeidiSQL) and also from CLI

LocalForward 3326 localhost:3306
mysql -uX -P3326  -h127.0.0.1 -p                                                         
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 334416

Using the same credentials and port in my app I get

 [error] MyXQL.Connection (#PID<0.1827.0>) failed to connect: ** (MyXQL.Error) (1044) Access denied for user 'X'@'localhost' to database

Anything I can do to debug further?

the-noob commented 1 year ago

After posting I thought about something, obviously. Running iex -S mix and then doing {:ok, pid} = MyXQL.start_link(hostname: "127.0.0.1", username: "Xport: 3326, password: "x") works so it's something with the initial config (done through .env)