mysqlsqlgoogle-cloud-platformgoogle-cloud-sql

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


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!


Solution

  • 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