ERROR 2005 (HY000): Unknown MySQL server host '[35.232.51.216]' (0) in google cloud SQL client
Asked Answered
Q

3

11

I am trying to connect my gcloud VM to a mySQL instance also on the cloud, and keep getting this errror:

ERROR 2005 (HY000): Unknown MySQL server host '[10.0.0.1]' (0)

I have followed the instructions from google's documentation here https://cloud.google.com/sql/docs/mysql/connect-admin-ip#connect-ssl and have not found any reasons as to why this could be happening after a lot of searching. I have double checked that the static IP of the VM is authorized, and that I have the right IP for the SQL database. I have tried two ways to connect, using these IP addresses and SSL.

    mysql --host=[10.0.0.1] --user=root --password=

and

    mysql --ssl-ca=server-ca.pem --ssl-cert=client-cert.pem --ssl- 
    key=client-key.pem  --host=[10.0.0.1] --user=root --password=ms

Both return the same error and I am at a loss as to where to look. Has anyone seen this before, or is more experienced in SQL? This is my first time using a SQL database on google cloud...

Thanks!

Quass answered 7/9, 2018 at 20:51 Comment(3)
It may not be secure to publish the actual IP of your MySQL instance, and I recommend obscuring when asking for help in a public platform. As to your issue, have you white-listed the IP of your VM in the Google CloudSQL console?Crider
Thanks, I changed it to a example IP instead. Yes I Whitelisted the IP in the Cloud SQL console, under "Authorization". I even re-listed it a couple times to make sure but no change....Quass
I think you should use the IP without the brackets in your command. As in "--host=10.0.0.1" not [10.0.0.1]. I really think the brackets in the example is just for notation. Can you confirm that you have tried --host=IP instead of --host=[IP]?Crider
C
12

In the documentation you pointed to, the example" mysql --host=[INSTANCE_IP] --user=root --password is to imply that the "[INSTANCE_IP]" should be substituted for the IP of your MySQL instance. However, in the snippets above it appears, you may have substituted only the inner content of the braces (i.e. [10.0.0.1]), so try re-running your commands without the braces around your IP:

mysql --host=10.0.0.1 --user=root --password

Crider answered 7/9, 2018 at 21:39 Comment(0)
K
0

dnt add the semicolon after the connection command like this ---> bin>mysql -u root -p -h localhost;(here) is the semicolon you just need to remove it and try it like this way.. bin>mysql -u root -p -h localhost

Keelby answered 20/4, 2021 at 10:12 Comment(0)
B
0

if you are trying to connect to mysql pod, this my help you:

kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql --host=pod-ip --user=root --password=password
Binion answered 25/7 at 8:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.