Can't connect to Google Cloud SQL - google-cloud-sql

I opened a trial account on Google Cloud and I'm having difficulties connection to Cloud SQL.
I made the basic setup, authorizing my IP/32 && adding a new User (appUser).
But I can't open a remote connection to the instance.
mysql -v --host=<ip> --user=appUser --password
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '<ip>' (60)
I'm at work and obviously behind a ton of firewalls and whatnot. Could this be the cause of my problems ?

There is a good change that it is a firewall problem. Error 2003 (from MySQL client manual) means that it can't connect to the server.
Can you try to connect through a computer outside the firewall?

Related

Cannot connect to MySQL Database in Workbench

It's my first time working with MySQL, so it's not much I know about it. I just installed MySQL Workbench client (no server) and attempted to connect to a MySQL database that exists on a different host.
I tried to connect to an external database and received an error. I used a Standard (TCP/IP) connection, entered an IP address for the other hosting machine, user name and password and clicked Test Connection. The error I am getting: "Failed to connect to MySQL at HostName with User. Unable to connect to localhost."
Why is it connecting to localhost if I entered a totally different IP? I don't have a localhost and I don't need it. Is there anything special that I have to do when I connect to a different server?

Connecting to Amazon RDS from local machine through an ec2-instance bridge

Hello all
I have a dabase seted up in RDS. Right now there is a ec-instance which is my test enviroment which connects to that RDS and working on a particular DB.
Now something with a migration might have messed up the data in that database.
What I am trying to do is connect to that database using pgAdmin 3 to check what's going on.
What I did is used the connect to a new server of pgAdmin
and used the SSH Tunnel tab.
In the properties I used the credentials of the RDS and in the SSH Tunnel(tab)
I used the ssh files I am using to connect to the testing instance I already know has access to the RDS.
Problem is I am getting
Error: SSH error: Error when starting up SSH session with error code
-8 [Unable to exchange encryption keys]
Does my logic make sense ?
Meaning to use the SSH tunnel to configure a connection to an ec2 instance and assume that throught this tunnel the pgAdmin is going to be able to connect to the actuall RDS hosted database ?
Any direction on how to proceed further are greatly appriciated !

Connecting to Google Cloud SQL PostgreSQL using Cloud Shell with SSL?

I've set up a PostgreSQL instance on Google Cloud SQL and have set it up now to only allow SSL connections. I'm able to connect from my workstation via psql and from some apps like R Studio.
However I'm trying to connect via the GCloud Shell and don't seem to see any options to connect with SSL. There are options to manage certifications and I've created another client key and downloaded the files for it in my cloud shell account, I just don't see options for using them to make a connection. Without it just tells me there isn't an HBA for a "No SSL" connection.
Here is what I see (some things obfuscated):
don#cloudshell:~ (xxx)$ gcloud sql connect foo --user=postgres
Whitelisting your IP for incoming connection for 5 minutes...done.
Connecting to database with SQL user [postgres].Password for user postgres:
psql: FATAL: connection requires a valid client certificate
FATAL: pg_hba.conf rejects connection for host "a.b.c.d", user "postgres", database "postgres", SSL off
As per Cloud SQL GCP docs:
Cloud Shell connections do not support SSL. Connections from Cloud
Shell fail if the instance is configured to accept only SSL
connections.

how to solve the error of DBeaver database?

I used DBeaver (database management tools) and faced this type of error
It looks like you're trying to connect to a MySQL instance over SSH. Most likely issue is that the remote server isn't accepting SSH connections. If you try the following at a command line, can you establish a connection? (Bash if you're using Linux, putty if you're on Windows)
ssh <user>#<remotehost>
Also it's important to mention that you probably have two sets of credentials you're using here. The credentials to connect to the SSH server are not necessarily the same as the credentials to connect to the MySQL database.

PGAdmin III cannot connect AWS RDS

I am trying to connect AWS RDS PostgreSql from PgAdmin 3. I followed the below link
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html
In Security Group, I also added PostgreSQL and All traffic as below
The "publicly accessible" flag was enabled (updated after Mark B's comment)
I got the error from PGAdmin3
Very appreciate for any suggestion
******UPDATE*******
I can connect pgAdminIII to AWS RDS successfully using home wifi, but cannot connect using office wifi.
My concern is:
Was the port 5432 blocked by office wifi?
How can I configure/update the port without impacting to current API?
Note: My current API is working well (CRUD)
Can you can test your connection to a DB instance using common Linux or Windows tools first?
From a Linux or Unix terminal, you can test the connection by typing the following (replace with the endpoint and with the port of your DB instance):
$nc -zv DB-instance-endpoint port
For example, the following shows a sample command and the return value:
$nc -zv postgresql1.c6c8mn7tsdgv0.us-west-2.rds.amazonaws.com 8299
Connection to postgresql1.c6c8mn7tsdgv0.us-west-2.rds.amazonaws.com
8299 port [tcp/vvr-data] succeeded!
Windows users can use Telnet to test the connection to a DB instance. Note that Telnet actions are not supported other than for testing the connection. If a connection is successful, the action returns no message. If a connection is not successful, you receive an error message such as the following:
C:>telnet sg-postgresql1.c6c8mntzhgv0.us-west-2.rds.amazonaws.com
8299
Connecting To sg-postgresql1.c6c8mntzhgv0.us-west-2.rds.amazonaws.com...Could not
open connection to the host, on port 819: Connect failed
If Telnet actions return success, then you are good to go.
If you are trying to access it from a network which is not listed for that port. you need to add inbound rules for those network IPs from AMAZON RDS system
You will also need to set Public accessibility true under Connect & security tab in RDS console.
Read this post.In your security group go to unbound rules and add my ip.
and make sure your database is public.
https://serverfault.com/questions/656079/unable-to-connect-to-public-postgresql-rds-instance