Reputation: 185
I created an external user with '%' hostname to allow remote access. I get the following error while connecting the local MySQL to remote AWS RDS:
ERROR 2003 (HY000): Can't connect to MySQL server on 'instance.cvxqy8tbi2bk.us-east-1.rds.amazonaws.com' (110).
I tried commenting the #bind-address = localhost
but no solution.
Any pointers for this?
Upvotes: 11
Views: 35434
Reputation: 11
Answer:
security groups
then edit inbound rules
then select mysql
, port 3306
,source anywhere-ipv4
Upvotes: 1
Reputation: 6006
This is an access problem.
You need to go to the security group of your database, click on the security group and then navigate to Security Groups and select inbound rules
Click on Edit Inbound rules
Add 2 new rules with Type as "All Traffic" and "Anywhere Ipv4" & "Anywhere Ipv4" for Source.
Save once done. Now you can connect to the MySQL DB
Upvotes: 1
Reputation: 33
If the DB instance is in a private subnnet you should be able to connect from the EC2 instance in private VPC after Set up EC2 connection when both EC2 and RDS are in same VPC.
mysql -h <endpoint> -P 3306 -u <mymasteruser> -p
To connect with RDS instance from outside check the followings:
Hope it helps!
Upvotes: 0
Reputation: 35
My problem was solved by setting public accessibility yes. https://aws.amazon.com/premiumsupport/knowledge-center/rds-connectivity-instance-subnet-vpc/
Upvotes: 0
Reputation: 33
I faced the same issue, turns out that I had made the database private to the VPC, meaning only instances in the vpc would be allowed to access the databse, so either make the DB public or try to access the database using an instance in your VPC.
Upvotes: 0
Reputation: 126
I had the same problem. this solution: When you create database
in the Virtual private cloud (VPC), please choose "Create new VPC"
in the VPC security group, please choose "create new", don't choose "choose existing"
Upvotes: 4
Reputation: 241
Anyone encountering this issue today should check out this YouTube video at around 6:05:
AWS RDS MySQL Database Setup | Step by Step Tutorial.
In a nutshell, you have to create a new inbound security rule to allow an external connection.
Upvotes: 24
Reputation: 137
change settings to Publicly accessible. by clicking Modify option
Upvotes: -3
Reputation: 13166
You should diagnose connection to ANY Mysql/Mariadb/RDS connection before changing any server parameter.
Always use this to check connection.
mysql -u username -p -h your_rds_instance_name
If connection fail, then check network connection(can you ping the instance name from your local system? ), i.e. firewall access, RDS Subnet rules, security groups rules. If the topics too advance for your, then follow the usual quickstart guidelines and tutorial.
Upvotes: 1
Reputation: 7677
"I tried commenting the #bind-address = localhost but no solution. "
No you cannot just comment it out.
If you want to allow remote connections to the MySQL database then you need to bind to your network adapter and not localhost / the loopback adapter.
So you need to get your server IP then:
bind-address = the.srv.ip.is
This is a better question for Server Fault ;)
Upvotes: 0