Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (12.9k points)

I want to connect to db on EC2 from my local machine, I am not able to do and have tried everything- I am using this command to connect to EC2:

mysql -uUSERNAME -hEC2_IP -pPASSWORD

This error is generated

ERROR 2003 (HY000): Can't connect to MySQL server on 'IP' (110)

I have modified my.cnf with

skip networking

bind-address = 0.0.0.0

Still not able to connect to the database

1 Answer

0 votes
by (18.2k points)

You can try looking into the following mentioned potential reasons that might be causing the error you are facing.

  • Make sure that you edit the security groups and add a rule to allow remote access from your machine to your Amazon EC2 instance.
  • MySQL will create a root user id by default which is only accessible from localhost. Which means that root user id and password will not work for the remote machine. To resolve this, you have to allow the root user to access MySQL from a remote machine.
  • Also, verify if the local firewall of your machine is enabled or not. If not, then enable it and make sure that port 3306 is open.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 31, 2019 in AWS by yuvraj (19.1k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...