Unable to connect remotely to MySQL on Node.js image

0

Hi,

I just opened a Lightsail instance on a Node.js image and I'd like to have a MySQL database on it.
I followed this guide (https://support.rackspace.com/how-to/installing-mysql-server-on-ubuntu/ ). Step by step, added a user with host '%' and added the preset MySQL/Aurora port 3306 to the networking config of my Lightsail instance. However when I try to connect remotely (local is fine) using HeidiSQL I get "Can't connect to MySQL server on 'IP-ADDRESS' (10061)".

asked 5 years ago362 views
1 Answer
0
Accepted Answer

Hello,
Thank you for using Lightsail.

That guide directs you to bind your MySQL server to localhost. Due to the network configuration of AWS, you need to use 0.0.0.0 in order to bind to external traffic (coming through your Public IP address).

If this is a server you use for a production application, in the interest of security it's recommended to keep the MySQL network port closed in your firewall and use SSH tunneling instead https://docs.bitnami.com/virtual-machine/faq/get-started/access-ssh-tunnel/

In that article, SOURCE means the local port you want to use to connect: ex 23306
DESTINATION is the address on the remote machine you want to reach: ex. 127.0.0.1:3306

Then you'd connect to localhost:23306 in HeidiSQL

Regards,
Gabriel

AWS
MODERATOR
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions