AWS RDS:使用 Navicat 连接
AWS RDS: Connect using Navicat
我刚刚在 N.Virginia 中创建了 RDS 实例并尝试使用 Navicat 连接该数据库。
但是无法连接。
上网查了一下才知道需要配置Security Groups。但就我而言,有一个通知:
Your account does not support the EC2-Classic Platform in this region. DB Security Groups are only needed when the EC2-Classic Platform is supported. Instead, use VPC Security Groups to control access to your DB Instances. Go to the EC2 Console to view and manage your VPC Security Groups. For more information, see AWS Documentation on Supported Platforms and Using RDS in VPC.
请帮我解决这个问题。 N.Virginia 也是 AWS 自动分配的。最好在免费层中选择 N.Viginia。
我可能不建议从您的本地系统直接 link 访问您的 RDS 数据库;我可能会建议只能登录表单 ec2 实例,但让我们看看
当您在 RDS 中创建数据库(将是 Oracle,mysql ...)时,您定义 how/who 将访问它。
- 使您的实例可公开访问
Select Yes if you want EC2 instances and devices outside of the VPC hosting the DB instance to connect to the DB instance. If you select No, Amazon RDS will not assign a public IP address to the DB instance, and no EC2 instance or devices outside of the VPC will be able to connect. If you select Yes, you must also select one or more VPC security groups that specify which EC2 instances and devices can connect to the DB instance.
如果您选择 yes
,您将能够从本地笔记本电脑连接到您的数据库。如果你说 no
那么只有从同一 VPC 中启动的 ec2 实例才能访问它。
- 定义您的 VPC 安全组
如果您 select 一个现有的 VPC,您可能有一些已定义的安全组。如果您没有 VPC 或没有现有的安全组。 Security groups可以看成是防火墙,你定义了打开哪个端口,谁可以访问。
如果您离开创建新的安全组,数据库将启动并且将创建一个新的安全组。您可以从 AWS 控制台查看(确保 select 您创建数据库的同一区域)或直接 https://console.aws.amazon.com/vpc/home?region=us-east-1#securityGroups:(如果您使用其他区域,请替换区域)。创建的新安全组将命名为 rds-launch-wizard
编辑安全组并查看入站规则,默认情况下 AWS 将创建一个新规则来打开端口(取决于数据库)到您的 IP,您可以更改它以打开更多 IP 或进一步限制。
安全规则是为 RDS 支持的数据库(Oracle、MS SQL 和 MySQL/Aurora)预定义的,因此当您添加新的入站规则时,只需 select 列表中的正确项目
数据库实例启动后,您可以查看端点
因此您可以从本地笔记本电脑进行连接
$ mysql -u <username> -p -h <database>.cnrsdab7emat.us-east-1.rds.amazonaws.com
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.6.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> status
--------------
mysql Ver 14.14 Distrib 5.6.22, for osx10.10 (x86_64) using EditLine wrapper
Connection id: 21
Current database:
Current user: <username>@90.27.155.48
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.10 MySQL Community Server (GPL)
Protocol version: 10
Connection: <database>.cnrsdab7emat.us-east-1.rds.amazonaws.com via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 6 min 33 sec
Threads: 5 Questions: 2656 Slow queries: 0 Opens: 89 Flush tables: 1 Open tables: 82 Queries per second avg: 6.758
--------------
mysql>
如果你更喜欢使用 Navicat 连接,你应该能够设置设置以建立相同的连接。
我刚刚在 N.Virginia 中创建了 RDS 实例并尝试使用 Navicat 连接该数据库。
但是无法连接。
上网查了一下才知道需要配置Security Groups。但就我而言,有一个通知:
Your account does not support the EC2-Classic Platform in this region. DB Security Groups are only needed when the EC2-Classic Platform is supported. Instead, use VPC Security Groups to control access to your DB Instances. Go to the EC2 Console to view and manage your VPC Security Groups. For more information, see AWS Documentation on Supported Platforms and Using RDS in VPC.
请帮我解决这个问题。 N.Virginia 也是 AWS 自动分配的。最好在免费层中选择 N.Viginia。
我可能不建议从您的本地系统直接 link 访问您的 RDS 数据库;我可能会建议只能登录表单 ec2 实例,但让我们看看
当您在 RDS 中创建数据库(将是 Oracle,mysql ...)时,您定义 how/who 将访问它。
- 使您的实例可公开访问
Select Yes if you want EC2 instances and devices outside of the VPC hosting the DB instance to connect to the DB instance. If you select No, Amazon RDS will not assign a public IP address to the DB instance, and no EC2 instance or devices outside of the VPC will be able to connect. If you select Yes, you must also select one or more VPC security groups that specify which EC2 instances and devices can connect to the DB instance.
如果您选择 yes
,您将能够从本地笔记本电脑连接到您的数据库。如果你说 no
那么只有从同一 VPC 中启动的 ec2 实例才能访问它。
- 定义您的 VPC 安全组
如果您 select 一个现有的 VPC,您可能有一些已定义的安全组。如果您没有 VPC 或没有现有的安全组。 Security groups可以看成是防火墙,你定义了打开哪个端口,谁可以访问。
如果您离开创建新的安全组,数据库将启动并且将创建一个新的安全组。您可以从 AWS 控制台查看(确保 select 您创建数据库的同一区域)或直接 https://console.aws.amazon.com/vpc/home?region=us-east-1#securityGroups:(如果您使用其他区域,请替换区域)。创建的新安全组将命名为 rds-launch-wizard
编辑安全组并查看入站规则,默认情况下 AWS 将创建一个新规则来打开端口(取决于数据库)到您的 IP,您可以更改它以打开更多 IP 或进一步限制。
安全规则是为 RDS 支持的数据库(Oracle、MS SQL 和 MySQL/Aurora)预定义的,因此当您添加新的入站规则时,只需 select 列表中的正确项目
数据库实例启动后,您可以查看端点
因此您可以从本地笔记本电脑进行连接
$ mysql -u <username> -p -h <database>.cnrsdab7emat.us-east-1.rds.amazonaws.com
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.6.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> status
--------------
mysql Ver 14.14 Distrib 5.6.22, for osx10.10 (x86_64) using EditLine wrapper
Connection id: 21
Current database:
Current user: <username>@90.27.155.48
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.10 MySQL Community Server (GPL)
Protocol version: 10
Connection: <database>.cnrsdab7emat.us-east-1.rds.amazonaws.com via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 6 min 33 sec
Threads: 5 Questions: 2656 Slow queries: 0 Opens: 89 Flush tables: 1 Open tables: 82 Queries per second avg: 6.758
--------------
mysql>
如果你更喜欢使用 Navicat 连接,你应该能够设置设置以建立相同的连接。