AWS RDS: Connect using Navicat

浪子不回头ぞ 提交于 2019-12-02 08:41:15

问题


I have just created RDS Instance in N.Virginia & trying to connect that database using Navicat.

But I'm unable to connect it.

After searching over internet I came to know that we need to configure Security Groups. But in my case there is a notification :

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.

Please help me out to resolve the issue. And also N.Virginia is what the AWS assigned automatically. It is good to opt for N.Viginia in Free-tier.


回答1:


I would probably not advised to get a direct link on your RDS Database from your local system; I would probably recommend to be able to only log in form ec2 instance, but lets look

When you create your Database in RDS (will be Oracle, mysql ...) you defined how/who will access it.

  1. Make your instance Publicly Accessible

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.

If you say yes you will be able to connect to your database from your local laptop. If you say no well only ec2 instance launched from within the same VPC will be able to access it.

  1. Define your VPC security groups

If you select an existing VPC, you probably have some defined security groups. In case you dont have VPC or no existing security groups. The Security groups can be viewed as acting like a firewall, you defined which port are opened and who can access.

If you leave Create new Security Group the DB will launch and a new Security Group will have been created. You can review from the AWS Console (make sure to select the same region where you created your DB) or directly https://console.aws.amazon.com/vpc/home?region=us-east-1#securityGroups: (replace the region in case you use something else). The new Security Group created will be named rds-launch-wizard

Edit the Security Group and review the inbound rules, by default AWS will have created a new rule to open the port (depending the DB) to your IP, you can change that to open to more IP or restrict further.

Security Rules are predefined for the RDS supported database (Oracle, MS SQL and MySQL/Aurora) so just select the right item from the list when you add a new inbound rule

When the DB instance has launched you can review the endpoint

and so you are able to connect from your local laptop

$ 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>

If you prefer to connect using Navicat, you should be able to set the settings to establish the same connection.



来源:https://stackoverflow.com/questions/39485147/aws-rds-connect-using-navicat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!