dokku/dokku-mysql

Connect to mysql service from remote

mtzfactory opened this issue · 4 comments

Hi,

I'm running Dokku on a Amazon EC2 instance, with this plugin installed. Everything works fine, my Dokku app can get data from the Dokku MySql database.

Now I want to do a remote connection to the MySql database from my Mac, so I did:
$ mysql:expose <name> [port]

After execute this command I can see the exposed port:
Exposed ports: 3306->30412

When I tried to connect from my computer I got the following message:

mysql-js> \c <user>@<hostname>:30412
Creating a Session to '<user>@<hostname>:30412'
Enter password:
ERROR: 2003 (HY000): Can't connect to MySQL server on '<hostname>' (61)

I thought this error could be related with Amazaon, so I opened the port 30412 in the EC2 instance (Security Groups -> Inbound)...

But when I tried againt to connect I got the same message... Where is my mistake?
How can connect to the MySql service from remote?

Thanks.
Ricardo

Please ensure you do not have iptables or ufw enabled and blocking that port.

Hi,

Thanks for the answer... but no iptables neither ufw... :-/

What else?

$ sudo ufw status verbose
Status: inactive
$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy DROP)
target     prot opt source               destination
DOCKER-USER  all  --  anywhere             anywhere
DOCKER-ISOLATION  all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain DOCKER (1 references)
target     prot opt source               destination

Chain DOCKER-ISOLATION (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain DOCKER-USER (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere
spnkr commented

I'm having the same problem. I'm using digitalocean. I've tried connecting via Sequel Pro (mac app), and the command line mysql, but neither work. Help!

If you are on digitalocean, the most common issue is that you did not expose your database - there is a subcommand for it, run dokku mysql:help expose to get usage information - and that ufw is enabled. Either disable it or open up the port for it.

ufw may also say its not enabled but is actually running, so turn it off if possible.