[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Translation issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
使用数据库客户端进行连接
本页面介绍如何将在客户端计算机上本地运行的 SQL Server 客户端连接到 Cloud SQL 实例。
需要帮助?如需获得代理问题排查方面的帮助,请参阅排查 Cloud SQL 代理连接问题。也可参阅我们的 Cloud SQL 支持页面。
准备工作
您必须首先完成以下操作,然后才能开始使用客户端:
使用本地客户端
如需使用本地客户端连接到 Cloud SQL 实例,请完成以下三项简要任务:
- 安装客户端。
- 配置对 Cloud SQL 实例的访问权限。
- 连接到 Cloud SQL 实例。
安装客户端
如需安装客户端,请按如下所述操作:
Debian/Ubuntu
对于 Debian/Ubuntu,请按照这些说明安装适用的 SQL Server 命令行工具。
CentOS/RHEL
对于 CentOS/RHEL,请按照这些说明安装适用的 SQL Server 命令行工具。
openSUSE
对于 openSUSE,请按照这些说明安装适用的 SQL Server 命令行工具。
配置对于实例的访问的方法如下:
- 在客户端机器上,使用我的 IP 是什么以查看客户端机器的 IP 地址。
- 复制该 IP 地址。
- 转到 Google Cloud Console 中的“Cloud SQL 实例”页面。
转到“Cloud SQL 实例”页面
- 点击相应实例以打开其概览页面,并记录其 IP 地址。
- 选择连接标签页。
- 在已获授权的网络下,点击添加网络,然后输入客户端安装所在机器的 IP 地址。
- 点击完成,随后点击页面底部的保存以保存更改。
- 连接到您的实例。
连接到您的 Cloud SQL 实例
要连接到您的实例,请执行以下操作:
- 确认您已安装客户端并配置对实例的访问权限。
- 使用
sqlcmd
命令进行连接,具体步骤与 SQL Server 快速入门和使用该实用程序页面上所提供的示例相类似。
要使用 SSL 连接到您的实例,请执行以下操作:
客户端启动的加密部分,以及在 Linux 上加密与 SQL Server 的连接页面中的相关部分。
后续步骤
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Translation issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-02-23 UTC.