azure aws_如何使用Azure Data Studio连接AWS RDS Microsoft SQL Server

azure aws

The goal of this guide is to play around with cloud databases and connect one to a database tool. Once you are done with this guide, you should be able to create databases and tables, and more.

本指南的目标是玩转云数据库并将其连接到数据库工具。 完成本指南后,您应该能够创建数据库和表等。

Importing a sample database is a pain, so here's another guide that I created: How to Import a Sample Database to your AWS RDS Microsoft SQL Server using S3.

导入示例数据库很麻烦,因此这是我创建的另一指南: 如何使用S3将示例数据库导入到您的AWS RDS Microsoft SQL Server

Luckily as I was new to this, I also discovered how to connect to a MSSQL Server with Docker to Azure Data Studio. Check this guide: How to Connect your AWS RDS Microsoft SQL Server using Azure Data Studio.

幸运的是,当我刚接触它时,我还发现了如何使用Docker将MSSQL Server连接到Azure Data Studio。 检查此指南: 如何使用Azure Data Studio连接AWS RDS Microsoft SQL Server

We will be touching on the technologies shown below:

我们将涉及以下技术:

  • Database: Amazon Relational RDS with MSSQL Server Express Edition

    数据库:带有MSSQL Server Express Edition的Amazon Relational RDS
  • Database tool and GUI: Azure Data Studio

    数据库工具和GUI:Azure Data Studio

创建和配置您的AWS RDS MSSQL Server实例 (Creating and Configuring your AWS RDS MSSQL Server Instance)

登录到AWS.com: (Sign in to AWS.com:)

  1. Go to https://aws.amazon.com/console/

    转到https://aws.amazon.com/console/

  2. Click Sign into your AWS account

    单击登录到您的AWS账户

创建一个Microsoft SQL Server数据库实例: (Create a Microsoft SQL Server DB Instance:)

  1. In the Create database section, choose Create database.

    在创建数据库部分中,选择创建数据库

2.   Choose Easy Create for database creation method.

2.选择“ 轻松创建”作为数据库创建方法。

3.   Choose the Microsoft SQL Server icon for engine type.

3.选择Microsoft SQL Server图标作为引擎类型。

4.   Select Free Tier for the DB instance size.

4.选择“ 免费层 ”作为数据库实例大小。

5.   Fill in the following details for DB instance identifier:

5.填写以下数据库实例标识符的详细信息:

  • DB instance identifier: myrdstest.

    数据库实例标识符: myrdstest。

  • Master username: Type a username

    主用户名:输入用户名

  • Master password: Type a password that contains from 8 to 41 printable.

    主密码:键入包含8到41个可打印密码。

6.   Select Create database.

6.选择创建数据库

Note: It might take a couple of minutes to provision

注意:设置可能需要几分钟

If you accidentally exit the page, you should see your database myrdstest under RDS > Databases.

如果您不小心退出了该页面,则应该在RDS > 数据库下看到数据库myrdstest

For a more detailed tutorial, follow the steps in the AWS docs.

有关更详细的教程,请遵循AWS docs中的步骤。

允许公共访问您的RDS实例 (Allow Public Access to your RDS instance)

  1. Click Modify

    点击修改

2.   Choose Yes in Public Accessibility under Network & Security.

2.在“网络和安全性”下的公共可访问性中选择“ ”。

3.  Choose Apply immediately under Scheduling of modifications, then Click Modify DB instance.

3.在“修改计划”下立即选择“ 应用” ,然后单击“ 修改数据库实例”

允许入站规则 (Allow Inbound Rules)

  1. Click default (sg-0000d009) under VPC security groups.

    单击VPC安全组下的默认(sg-0000d009)

Note: the number is different in your own instance.

注意:该数字在您自己的实例中是不同的。

2.   Click Inbound, then click Edit inbound rules.

2.单击入站 ,然后单击编辑入站规则

3.  Choose My IP in Source, then click Save rules.

3.在源中选择我的IP ,然后单击保存规则

测试您与AWS RDS的连接 (Test your Connection to AWS RDS)

Open your terminal (MacOS), and type the following: nc -zv aws_rds_endpoint port_number

打开终端(MacOS),然后键入以下内容: nc -zv aws_rds_endpoint port_number

Successful connection example:

成功的连接示例:

Failed connection example:

连接失败示例:

Make sure your RDS instance is Public and Inbound rules allows your IP.

确保您的RDS实例为“公共”,并且“入站”规则允许您使用IP。

下载SQL Server GUI-Azure Data Studio (Download a SQL Server GUI - Azure Data Studio)

Azure Data Studio (formerly SQL Operations Studio) is a free GUI management tool that you can use to manage SQL Server. You can use it to create and manage databases, write queries, backup and restore databases, and more.

Azure Data Studio (以前称为SQL Operations Studio)是一个免费的GUI管理工具,可用于管理SQL Server。 您可以使用它来创建和管理数据库,编写查询,备份和还原数据库等等。

Azure Data Studio is available on Windows, Mac, and Linux.

Windows,Mac和Linux上都可以使用Azure Data Studio。

安装Azure Data Studio (Install Azure Data Studio)

To install Azure Data Studio on a Mac:

在Mac上安装Azure Data Studio:

  1. Visit the Azure Data Studio download page, and click the .zip file for macOS

    访问Azure Data Studio下载页面 ,然后单击macOS的.zip文件

  2. Once the .zip file has finished downloading, double click it to expand its contents

    .zip文件下载完成后,双击它以展开其内容
  3. Drag the .app file to the Applications folder.

    将.app文件拖到Applications文件夹中。

连接到SQL Server (Connect to SQL Server)

Now that Azure Data Studio is installed, you can use it to connect to SQL Server:

现在已经安装了Azure Data Studio,您可以使用它来连接到SQL Server:

  1. Launch Azure Data Studio. It is located in your Applications folder.

    启动Azure Data Studio。 它位于您的应用程序文件夹中。
  2. Enter the login credentials and other information for the SQL Server instance that you’d like to connect to:

    输入您要连接SQL Server实例的登录凭据和其他信息:

It should look similar to this:

它看起来应该类似于:

  • Server Name: [AWS RDS Endpoint], [port number]

    服务器名称 :[AWS RDS端点],[端口号]

    Server Name: [AWS RDS Endpoint], [port number] Example: myrdstest.blahblahblah.us-west-2/ds.amazonaws.com, 1433

    服务器名称 :[AWS RDS端点],[端口号] 示例 :myrdstest.blahblahblah.us-west-2 / ds.amazonaws.com,1433

  • Authentication Type: SQL Login

    身份验证类型 :SQL登录

  • User name: [your AWS username]

    用户名 :[您的AWS用户名]

  • Password: [your AWS password]

    密码 :[您的AWS密码]

  • Database Name: <default>

    数据库名称 :<默认>

  • Server Group: <default>

    服务器组 :<默认>

If you used a port other than the default 1433, click Advanced and enter it in the Port field.

如果您使用的端口不是默认的1433,请单击“ 高级” ,然后在“端口”字段中输入它。

Alternatively, you can append it to your server name with a comma in between. For example, if you used port 1400, type in localhost,1400.

或者,您可以将其附加到服务器名称,中间使用逗号。 例如,如果您使用端口1400,则键入localhost,1400。

If you get an error:

如果出现错误:

Make sure your RDS instance is Public and Inbound rules allows your IP.

确保您的RDS实例为“公共”,并且“入站”规则允许您使用IP。

You can now go ahead and create databases, run scripts, and perform other SQL Server management tasks.

现在,您可以继续创建数据库,运行脚本并执行其他SQL Server管理任务。

  1. Click New Query

    点击新查询

2.   Type SELECT @@VERSION, then Click Run Query.

2.键入SELECT @@ VERSION ,然后单击“运行查询”

You should be able to see: Microsoft SQL Server in the Results

您应该能够看到:结果中的Microsoft SQL Server

Congratulations! 🎉🎉🎉

恭喜你! 🎉🎉🎉

资源: (Resources:)

Connect with me on LinkedIn here

此处通过LinkedIn与我联系

翻译自: https://www.freecodecamp.org/news/cjn-how-to-connect-your-aws-rds-microsoft-sql-server-using-azure-data-studio/

azure aws

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值