Can't access AWS RDS MySQL from Webserver - mysql

I have an AWS RDS MySQL instance that I'm able to connect to from my personal desktop using MySQL workbench and a PHP page, but once I put the PHP page on my webserver, I get the following error:
Error: Unable to connect to MySQL. Debugging errno: 2003 Debugging error: Can't connect to MySQL server on '[SERVERVNAME].ciuo9o7t5ksk.us-west-2.rds.amazonaws.com' (111)
I've searched and found that typically it is because the incoming IP rules don't allow the port, but I set the security settings to allow all incoming IPs (and I certainly didn't add any special rule for my perosnal PC IP), so not sure what I'm missing.
I use netfirms for webhosting - they told me that I'll need to configure my AWS instance, but I don't know what I'm missing.

First please check which security group is attached with the AWS RDS Mysql Instance,
Click on the attached security group and all the rule like this

Related

AWS: Not able to connect to mysql(rds) from wordpress

I'm trying to connect to mysql instance on rds via worpress, but I get this error:
Warning: mysql_connect(): Unknown MySQL server host '***********************' (111) in /var/www/html/wp-includes/wp-db.php on line 1568
Error establishing a database connection...
As I have read, (111) is for permission error. But I'm able to connect to the instance via workbench. In fact I was able to connect via wordpress earlier too.
This is driving me crazy. Please help. (My wp-config.php is correct. Checked it a 1000 times)
The following checks have to be done:
The subnet group for RDS needs to have inbound traffic enabled from the subnet group that has the WordPress server installed.
Make sure all NACL rules that control traffic between the subnets are not blocking this traffic
The WP server subnet group should not be blocking outgoing traffic to the RDS group. If needed add the RDS subnet group to the outgoing traffic from the EC2 instance hosting the WP server.

Connecting MySQLWorkbench to Amazon Web Services EC2 Instances

I have no idea how to connect mySQL to amazon EC2 Instance. Here is the screenshot of mySQL workbench: mySQL. I try to change the HostName to the Public IP being provided by the instance, however when i press test connection, it keep promoting this error: Error Message. So what should i do as of now? Thanks!!
Since I cannot put a comment, pardon me for putting this to the
Answers Section
Error 10060 is a generic error that means your client cannot reach the server.
Try pinging your server IP, if it responds, it is online.
Are you sure that the port that EC2 uses is also 3306? Configure your EC2 Instance to allow remote connections. Check the EC2 Security features, something might be blocking you.
AFAIK, the root user is only limited to localhost. So it won't work if you use it remotely. Create a new user with the privileges that you only need, then use the '%' wildcard which means any host.
And finally, you may want to try this: Step by Step instructions
In your EC2 instance you will have a Security Group Column.
Click on that will open the security group page
In the bottom of the page you have a tab called Inbound
Click Edit and then Add Rule to allow port 3306.
In source select anywhere option.

Unable to connect to Google Cloud SQL instance using a client mysql CL tool

I am having trouble making the initial connection to my freshly created cloud sql instance.
I followed the steps outlined here: https://developers.google.com/cloud-sql/, which includes getting an IP, whitelisting my IP, and setting a root password.
However, when I try to connect using the mySQL command line tool, I get this error message:
mysql --host=xxx.xxx.xx.xxx --user=root --password
ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xx.xxx' (10060)
I have a feeling that struggling at such a basic step implies my issue is specific only to me (calling for google cloud sql support folks).
I had the same issue, after a few minutes I got it going..
Make your GCE service has cloud SQL enabled (during instantiation)
Have a static ip for your GCE instance (you can use cloud console even while instance is running), and configure cloud SQL to accept this ip
set a root password for the cloud SQL
then your command is
mysql --host= --user=root --password=
My issue turned out to be related to the ISP (comcast) blocking outbound requests on port 3306. After setting up port forwarding, I'm able to connect directly from my pc to cloud sql WITHOUT using a GCE instance.
If others encounter this issue, I would recommend checking whether the port 3306 is available first (firebind, portquiz, etc).

Unable to connect to MYSQL on a remote computer

I am working on windows and having a remote desktop connection of another machine. I am trying to connect to the mysql running on the remote machine through my MySql workbench, installed on my machine.
When I specify the details to connect to mysql i.e.
IP- a.b.c.d
port-3306
username=root
password=
But everytime it shows me an error saying-
Your connection attempt to connect to user='root'failed from your host to server at a.b.c.d:3306
Is it possible that I can connect to mysql on a different machine?
Certainly that is possible, mysql is a network transparent service. However obviously the normal access authorization rules apply.
do you have network access to the mysql port, this might be blocked by a firewall. You can check that by using telnet ip-address-of-server 3306. Does the server answer or do you get a timeout or are blocked? (the answer would look cryptic, soomething like 5.5.33-MariaDB[*[n7p~g!�iXccI$r9``Y{$mysql_native_password or similar )
the mysql server can be configured to not listen to remote connections. This can add security to the setup, but would obviously block any remote connection attempts. You will have to check the configuration files of mysql for that.
mysql itself implements an authorization level. So check if that 'root' user actually is allowed to connect from the outside. Those authorizations are stored in the internal "mysql" database.
Also it is not clear from the question what your network topology is: is the mysql server running on that system you have a "remote connection" to? Is the mysql-workbench running on that remote system or on your local system? This might affect the ip address you have to use inside the workbench.

Connecting to Amazon RDS MySql remotely

I'm trying to connect to MySql on Amazon RDS from my computer, using MySql WorkBench, or HeidiSql or even the console Mysql.exe and i'm getting this error all the time:
ERROR 2003 (HY000): Can't connect to MySQL server on 'MY-SERVER-NAME' (10060)
In the Security group of the instance I created a new Inbound rule that allows all traffic, and applied it, and still - same error.
I have no active Firewall on my computer, and have good internet access
I am able to access the DB from the Amazon EC3 server, there I am connecting using HeidiSql, and the exact same settings (host, username, password) is just not working on my computer
Still, nothing is working. I'm pretty sure that my security groups is configured to allow outside connections, as can be seen on the next screenshot, there is another place with firewall rules?
I was having the same problem when using an RDS instance on a VPC that I wanted to connect to remotely. To fix the problem, I needed to do the following:
Go to the VPC Management Console in AWS
Go to Internet Gateways (on the left side)
Create and attach an internet gateway to my VPC. Make note of the ID of this gateway.
Go to Route Tables
Edit the route table associated with the subnets associated with your RDS instance
Add a route:
Destination: 0.0.0.0/0
Target: ID of your Internet Gateway
I didn't have this route in my table because I created my VPC manually and without using the wizard, but if you use the wizard it creates this route for you automatically.
Note: This assumes that your security groups are already configured to allow your IP to connect.
The 2003 error is the Access-Denied Error I would be willing to bet that you haven't configured the RDS to accept your IP address.
This can be done by going to DB Security Groups -> Click Default -> and add a new CIDR/IP range. I believe that if you set it to 0.0.0.0/0 it will accept all ip addresses
I use SQLyog for connecting to Amazon RDS from my machine.
You can refer this blog: http://blog.webyog.com/2009/11/06/amazon-rds-the-beginners-guide/
The security group settings are just firewall rules. If you can telnet on your configured MySQL port from the host you are having problems then you don't have the security group issue.
Chances are the MySQL grants are not allowing outside IPs. If you know the root user/password and you can use it to connect from your EC2 instance that works, make sure the user you are using to connect from outside has the right privileges. Here is the doc on how to add a new privilege or create a new user:
http://dev.mysql.com/doc/refman/5.1/en/grant.html
http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
http://dev.mysql.com/doc/refman/5.0/en/access-denied.html
Did you assign the security group to your RDS instance? If you didn't modify the default security group, then you need to add your security group to your RDS instance.
In my case, my company had two different network connections. When I went to google and searched "What is my IP?" I got one answer; 209.x.y.z. When I went to checkip.amazonaws.com I got another answer; 199.a.b.c.
I had already added VPC Security Group Rules for 209.x.y.z and it turned out I needed them for 199.a.b.c.
Adding rules for 199.a.b.c fixed the issue.
I had same problem as you, all firewall have been opened, but still can not access to my RDS mysql remotely from my local machine. my finally workout is there is a "Public Accessibility" option on your RDS database. default is "No", after I tick it to "YES", everything is running smoothly now.