Reputation: 3019
I am running an Amazon Linux EC2 instance with MySQL v 5.5.54. I am also running a dev version of my application locally. Is there a way to connect to this remote MySQL database from my local machine?
I tried the standard:
mysql -h <my dns name> -P 3306 -u myuser -p
but my session hangs and nothing gets returned. I am also not seeing any connection attempts in EC2's MySQL logs.
Upvotes: 0
Views: 843
Reputation: 200672
Open port 3306 in the Security Group, with the inbound source set to your local IP address. Comment out the bind-address
setting in my.cnf
or change it to something like 0.0.0.0, and restart the MySQL service on the EC2 server. More info on bind-address here.
Alternatively, a more secure method would be to use SSH port forwarding.
Upvotes: 2