无法登录google cloud storage sql实例 [英] not able to login in google cloud storage sql instance

查看:97
本文介绍了无法登录google cloud storage sql实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google Cloud>存储> SQL> MYSQL中创建了实例.现在我必须在其中导入数据库,所以我试图连接到MYSQL

I made instance in Google Cloud > Storage > SQL > MYSQL. Now I have to import database in it so I am trying to connect to MYSQL

使用管理员,但出现以下错误

using adminer, but it gives following error

SQLSTATE [HY000] [2002]操作超时

SQLSTATE[HY000] [2002] Operation timed out

我也尝试通过HeidiSQL> MariaDB或MYSQL(SSL隧道),但是在这里它也无法连接并给出错误消息

I also tried via HeidiSQL > MariaDB or MYSQL (SSL Tunnel) but here also it does not connect and gives error

https://prnt.sc/o58in0

我要提到

主机:SQL实例的公共IP

Host: Public Ip of SQL instance

用户名:root

任何建议,有什么解决办法?

Any suggestions, what could be the fix?

推荐答案

您的错误通常表示防火墙阻止了您的连接尝试.

Your error typically means that a firewall blocked your connection attempt.

对于Cloud SQL,这通常意味着您尚未启用实例级访问.

For Cloud SQL, this typically means that you have not enabled instance-level access.

由于您的错误是10060,这是Windows WinSock错误消息,因此我假设您正在Windows上运行.这些步骤与Linux相似.

Since your error is 10060, which is a Windows WinSock error message, I am assuming that you are running on Windows. The steps are similar for Linux.

有两种方法可以访问Cloud SQL:

There are two methods to enable access to Cloud SQL:

Cloud SQL代理

这是推荐的方法,很安全.将Cloud SQL代理下载并安装到要从其连接的计算机上.如果您设置了Cloud SDK(gcloud),则Cloud SQL代理将使用您的Cloud SDK凭据.如果没有,那么您将需要使用(通常)Cloud SQL Client角色来创建和下载服务帐户.

This is the recommended method and is secure. Download and install the Cloud SQL Proxy to your the computer that you want to connect from. If you have set up the Cloud SDK (gcloud), Cloud SQL Proxy will use your Cloud SDK credentials. If not, then you will need to create and download a service account with (usually) the Cloud SQL Client role.

您将需要Cloud SQL实例详细信息页面上的实例连接名称".

You will need the "instance connection name" from Cloud SQL Instance details page.

  • 将Cloud SQL代理(链接)下载到您的计算机.记住该程序的完整路径.将程序另存为"cloud_sql_proxy.exe"
  • 启动Cloud SQL代理
  • Download Cloud SQL Proxy (link) to your computer. Remember the full path to the program. Save the program as "cloud_sql_proxy.exe"
  • Start the Cloud SQL Proxy

[full_path_to_program] \ cloud_sql_proxy -instances = [INSTANCE_CONNECTION_NAME] = tcp:3306

OR

[full_path_to_program]\cloud_sql_proxy -instances=<INSTANCE_CONNECTION_NAME>=tcp:3306 -credential_file=[PATH_TO_KEY_FILE]

  • 使用mysql.exe连接:`mysql -u USERNAME -p --host 127.0.0.1
  • 公共IP方法

    第二种方法是不安全的,除非您还启用了SSL,我将不在此答案中介绍.除了知识渊博的人,我不建议使用这种方法.

    The second method is not secure unless you also enable SSL, which I will not cover in this answer. I do not recommend this method except for knowledgeable persons.

    转到Google云控制台

    Go to the Google Cloud Console

    注意:大多数家庭Internet服务会定期更改您的公共IP地址.这意味着,如果您使用第二种方法,则需要在Cloud SQL中更新您的公共IP地址.

    Note: Most home Internet services change your Public IP address periodically. This means that you will need to update your Public IP address in Cloud SQL if you are using the second method.

    这篇关于无法登录google cloud storage sql实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆