Connecting to AWS with MySQL Workbench - mysql

I am new to AWS RDS and I am trying to connect MySQL workbench to the instance on AWS. I want to have full admin access in the Database.
Connection Method: Standard TCP/IP over SSH
SSH Hostname: (AWS given endpoint)
SSH UserName: (not sure which user name they are asking for...ec2 or root?)
SHH Password:
SSH Keyfile: assuming this is the .pem file from AWS
MySQL HostName: 127.0.0.1
MySQL ServerPort: 3306
username: mysql username
password: mysql username password
Very new to this so any help would be greatly appreciated!
Thanks,
OK_Sooner

Be sure that security group of your instance accept connections from your ip. And as John Rotenstein said - you don't need to connect by ssh. Just connect to port 3306.

Related

how to connect navicat to mysql on aws EC2?

When I tried to use navicat to connect mysql on AWS, it always reject the connection.
I'm sure my IP address is correct and the port is correct as I checked on EC2 for several times. Also the username and password are correct too because I can log in mysql on EC2.
I don't know what is wrong here. Any help would be really appreciated.
The first thing that will validate is that your instance of aws has active the port to which you want to connect in this case 3306 if it does not work with this you can connect by means of a SSH of the following way remembering that it has to have active the port 22:
Configure the ssh option
host: add the one that EC2 gives you e.g. ec2-127-0-0-1.compute-1.amazonaws.com.
Port: 22.
user: ubuntu or root (or the one indicated in your aws configuration).
Authentication Method: public key.
Private key: your .pem
In general:
Connection Name: whatever you want
Host: localhost or 127.0.0.1
Port: 3306
User: the database user
Pass: the database user.

Can't connect to AWS RDS MySQL instance

I am not able to connect to a fresh instance of AWS RDS MySQL
mysql -h <host>.rds.amazonaws.com -P 3306 -u admin -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '<host>.rds.amazonaws.com' (111)
The credentials are correct.
Here are the inbound security rules
I have even set "Public Accessibility" to "Yes" (which I don't want to) but no luck. Any help? Thanks
EDIT 1:
Output of telnet after rebooting rds instance :
telnet host.rds.amazonaws.com 3306 Connecting To
host.rds.amazonaws.com...Could not open connection to the host, on
port 3306: Connect failed
Route Table:
Network ACL:

SSH error when trying to connect to laravel forge database with mysql workbench (can connect fine through a console)

I'm having trouble connecting to my database through mysql workbench even though I can do it through a console. It doesn't seem like I'm even getting past ssh because this is my error
Here are my connection settings:
Connection Method: Standard TCP/IP over SSH
SSH Hostname: DropletIP:22
SSH Username: forge
SSH Key File: C:\Users\username\.ssh\id_rsa
MySQL Hostname: 127.0.0.1
MySQL Server Port: 3306
Username: forge
The workbench is version 8 and the mysql version on the droplet is version 8.
I've tried switch all kinds of stuff around like removing the port on the ssh hostname, trying the public ssh key instead of the private, and changing the mysql hostname to the DropletIP. None of these worked.
Not really sure why this is happening. I appreciate any help.
you should use the server IP address as your MySQL HOSTNAME

AWS - Bastion ssh tunnel to access RDS -- connecting to SSH server but not MySQL server

I have a Bastion host set up to be able to SSH into my RDS instance. I'm using Navicat 12 to make the connection to the database, and I'm reaching the SSH server on both Navicat as well as PuTTY, but I'm not able to actually reach the RDS instance and I'm getting the following error:
2013 - Lost connection to MySQL server at 'reading initial
communication packet', system error: 0 "Internal error/check (Not
system error)"
Here are the settings I'm using to connect:
SSH settings:
Host: my bastion public DNS
Port: 22
Username: ec2-user
Authentication Method: public key
Private key: my key path
Passphrase: none
Connection Settings:
Endpoint: my rds endpoint
Port: 3306
Username: my rds username
Password: my rds password
(I've also tried root with no password on this to test)
Security Group Info:
Bastion-
SSH/TCP/22/my local IP
RDS-
MYSQL/Aurora / TCP/3306/anywhere
If anyone can offer any sort of guidance or troubleshooting, I would super appreciate it!
AWS do not allow direct SSH access onto their RDS instances, I couldn't find where they state it in there documentation but there is this Forum where they say:
https://forums.aws.amazon.com/thread.jspa?threadID=93277
However - If you need to run scripts directly against the RDS you can install psql (or equivalent) on the bastion and connect to it through that.

can't access fortrabbit mysql db through terminal (ssh)

I can't access mysql through terminal on fortrabbit. I follow all steps but it is rejecting my password. However I can regullary login through ssh and edit my application. Anyone had that issue ? Thanks.
I have solved this in the past using a SSH tunnel. You open an SSH tunnel to the server, and then you connect to the MySQL server there from the endpoint of that tunnel. As such, to MySQL you appear to be connecting locally.
From the terminal:
First you need to open the tunnel, you can do it like this:
ssh -N -L8889:127.0.0.1:3306 username#your.fortrabbit.domain.com &
This opens port 8889, then opens a tunnel to your.fortrabbit.domain.com, then forwards that local port through the tunnel to the IP 127.0.0.1 and port 3306 relative to the server at your.fortrabbit.domain.com.
The options in more detail:
-N: Do not execute a remote command.
-L: Specifies the ports (local and remote).
8889: Your local port that is being forwarded.
127.0.0.1: the remote IP to which you're forwarding, relative to the server which ssh is connecting to
3306: the remote port to which you're forwarding.
username#your.fortrabbit.domain.com: Your username and domain with fortrabbit.
Now you're ready to open the connection. In the same terminal, use the following command:
mysql -h 127.0.0.1 -P 8889 -u mysql-username -p
port 8889 is now being forwarded to the port and IP of your MySQL server on the fortrabbit side, so just replace mysql-username with your username on the mysql server, and you're connected!
From a GUI:
You mentioned in your comments that you're using Ubuntu, so install MySQL Workbench from the Software Centre or here, create a New Connection and select the connection type as "Standard TCP/IP over SSH".
You will need to configure the following:
SSH Hostname: the hostname or IP of your ssh account with fortrabbit
SSH Username: your username with them
SSH Password: your password with them
SSH Keyfile: If you use keys for authentication, select the private one here.
MySQL Hostname: 127.0.0.1 (because it's local to the endpoint of your tunnel.
MySQL Server Port: normally "3306".
Username: The username for the DB
Password: The password for the DB
Default Schema: Whatever should be the default schema for this DB (can be left blank).
That should then connect from wherever you are!