简体   繁体   English

如何将 MySQL Workbench 连接到 Amazon RDS?

[英]How to connect MySQL Workbench to Amazon RDS?

I am accessing the Amazon RDS (MySQL) from Putty.我正在从 Putty 访问 Amazon RDS (MySQL)。 MySQL Workbench works through SSH commandline only, but I would like to access the cloud MySQL host database directly from MySQL Workbench. MySQL Workbench 仅通过 SSH 命令行工作,但我想直接从 MySQL Workbench 访问云 MySQL 主机数据库。

This solution worked for me: Add your IP to the Security Group rules as follows.此解决方案对我有用:将您的 IP 添加到安全组规则中,如下所示。 Assuming you have logged into AWS:假设您已登录 AWS:

  1. Go to RDS -> Databases -> Select your database转到 RDS -> 数据库 -> 选择您的数据库

在此处输入图片说明

  1. Make sure the Public Accessibility value is Yes确保公共可访问性值为在此处输入图片说明

  2. Check your IP address using http://checkip.amazonaws.com/ .使用http://checkip.amazonaws.com/检查您的 IP 地址。 If it is not added to the Security Rule Groups, you should add it.如果未将其添加到安全规则组,则应添加它。 this step is crucial这一步很关键

3.1. 3.1. Click on the rule name.单击规则名称。 This will open up a new tab, then click in the name of the rule.这将打开一个新选项卡,然后单击规则名称。

在此处输入图片说明

3.2. 3.2. Click on Edit inbound rules点击编辑入站规则

在此处输入图片说明

3.3. 3.3. Click on Add new rule, and add a rule with the following values:单击添加新规则,然后添加具有以下值的规则:

Type: MYSQL/Aurora.类型: MYSQL/Aurora。

Protocol: TCP (default)协议: TCP(默认)

Port range: 3306 (default)端口范围: 3306(默认)

Source: My IP -> This will be the IP Address you got at http://checkip.amazonaws.com/ .来源:我的 IP -> 这将是您在http://checkip.amazonaws.com/ 上获得的 IP 地址。

在此处输入图片说明

  1. Fill information in MySQL Workbench在 MySQL Workbench 中填写信息

在此处输入图片说明

Hostname : Use the value you have for Endpoint at Connectivity and Security主机名:使用您在连接性和安全性的端点的值

Port : Use the value you have for Port at Connectivity and Security, by default it is 3306.端口:使用您在连接和安全中为端口设置的值,默认为 3306。

Username : Use the value you have for master username at Configuration用户名:使用您在配置中作为主用户名的值

Password : Use the value you set when you created the database instance.密码:使用您在创建数据库实例时设置的值。

If you forgot the password, you can change it by clicking on Modify in your database instance or if you're using AWS Elastic Beanstalk or so you can SSH into the instance and run the command如果您忘记了密码,您可以通过单击数据库实例中的修改来更改密码,或者如果您使用的是 AWS Elastic Beanstalk,或者您可以通过 SSH 进入实例并运行命令

/opt/elasticbeanstalk/bin/get-config environment

and you'll find that information in it.你会在其中找到这些信息。

在此处输入图片说明 在此处输入图片说明

In the MySQL forums is a posting that links to various sources for connecting MySQL Workbench to online resources: http://forums.mysql.com/read.php?152,252640,252640#msg-252640 .在 MySQL 论坛中有一个帖子,链接到将 MySQL Workbench 连接到在线资源的各种来源: http : //forums.mysql.com/read.php?152,252640,252640#msg-252640 The essential steps for Amazon RDS are on this page: https://thoughtsandideas.wordpress.com/2012/05/17/monitoring-and-managing-amazon-rds-databases-using-mysql-workbench/ Amazon RDS 的基本步骤在此页面上: https : //thoughtsandideas.wordpress.com/2012/05/17/monitoring-and-managing-amazon-rds-databases-using-mysql-workbench/

Step 3) Fill in the values as described below which illustrated in Figure 4.步骤 3) 填写如下所述的值,如图 4 所示。

  • Connection Name – Provide a name to identify your connection Connection Method – Select Standard TCP/IP over SSH from the drop down list instead of Standard(TCP/IP).连接名称 – 提供一个名称来标识您的连接 连接方法 – 从下拉列表中选择标准 TCP/IP over SSH,而不是标准 (TCP/IP)。 Then on the appearing two tabbed pane, fill the following values found under Parameters tab.然后在出现的两个选项卡式窗格中,填写在“参数”选项卡下找到的以下值。
  • SSH Hostname – Provide the Public DNS of the Amazon EC2 instace (refer Figure 3) which will be used as the intermediate server instance used to create the connection with the DB instance. SSH 主机名 – 提供 Amazon EC2 实例的公共 DNS(参见图 3),它将用作中间服务器实例,用于创建与数据库实例的连接。
  • SSH Username – Provide the user of the Amazon EC2 instance (refer Figure 3) which will be used as the intermediate server instance used to create the connection with the DB instance. SSH 用户名 – 提供 Amazon EC2 实例的用户(参见图 3),该实例将用作中间服务器实例,用于创建与数据库实例的连接。
  • SSH Key File – Provide the Private Key (xxx.pem) used to connect Amazon EC2 instace via SSH SSH 密钥文件 – 提供用于通过 SSH 连接 Amazon EC2 实例的私有密钥 (xxx.pem)
  • MySQL Hostname – Provide the Endpoint of the DB instance created in Amazon RDS(refer Figure 5). MySQL 主机名 – 提供在 Amazon RDS 中创建的数据库实例的终端节点(参见图 5)。
  • Username – Provide the Master Username of the DB instance created in Amazon RDS(refer Figure 5).用户名 – 提供在 Amazon RDS 中创建的数据库实例的主用户名(参见图 5)。

  • Password – Click on Store in Keychain.. button and type the password provided while creating the DB instance in Amazon RDS.密码 – 单击 Store in Keychain.. 按钮并键入在 Amazon RDS 中创建数据库实例时提供的密码。

  • In the MySQL Workbench Click on Setup new Connection,在 MySQL Workbench 中点击 Setup new Connection,
  • Give the Connection name and Select the Connection method as Standard TCP/IP,提供连接名称并选择连接方法作为标准 TCP/IP,
  • Enter the host name from RDS end point and port as 3306,输入来自 RDS 端点和端口的主机名 3306,
  • Enter Mysql user name and password as given in RDS instance creation,输入 RDS 实例创建中给出的 Mysql 用户名和密码,
  • Then test the connection and click ok.然后测试连接并单击确定。

测试 MySQL 连接

Very helpful , was able to make the connection was missing critical part非常有帮助,能够使连接丢失关键部分

3.3. 3.3. Click on Add new rule, and add a rule with the following values:单击添加新规则,然后添加具有以下值的规则:

Type: MYSQL/Aurora.类型:MYSQL/Aurora。

Protocol: TCP (default)协议:TCP(默认)

Port range: 3306 (default)端口范围:3306(默认)

Source: My IP -> This will be the IP Address you got at http://checkip.amazonaws.com/ .来源:我的 IP -> 这将是您在http://checkip.amazonaws.com/ 上获得的 IP 地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM