avatar
connect to MySQL database over SSH with Workbench SSH

» First and foremost, let setup MySQL Workbench on your local machine. Then, click `+` icon next to `MySQL Connections` to create new connection.

» Open Setup New Connection, choose the option `Standard TCP/IP over SSH` in the Connection Method dropdown, and then click on the Parameters tab.

There are some notes that you need to review before accessing the database.

» In AWS, the MySQL host addresses can differ for several reasons:

  • Localhost (127.0.0.1): This address refers to the local machine. If you have MySQL installed on your local machine or on an EC2 instance, you might connect to it using 127.0.0.1.
  • RDS Endpoint: The address `db-1-instance-2-cluster-cluster.cluster-flagtick.ap-southeast-1.rds.amazonaws.com` is typical endpoint for Amazon RDS (Relational Database Service) instance. This endpoint allows you to connect to your MySQL database hosted by AWS RDS from any machine that has network access to the RDS instance.

Using AWS RDS (option 2) can potentially increase costs compared to running MySQL on a single local machine. For example:

Option 1:

SSH Hostname: xxx:xxx:xxx:xxx:22
SSH Username: <your SSH Username>
SSH Password: skip it (no need)
SSH key File: <your pem file>

MySQL Hostname: 127.0.0.1
MySQL Server Port: 3306
Username: <Your Database Username>
Password: <Your Database Password> (should store in Vault)

Option 2:

SSH Hostname: xxx:xxx:xxx:xxx:22
SSH Username: &lt;Your SSH Username&gt;
SSH Password: skip it (no need)
SSH key File: &lt;Your pem file&gt;

MySQL Hostname: db-1-instance-2-cluster-cluster.cluster-flagtick.ap-southeast-1.rds.amazonaws.com
MySQL Server Port: 3306
Username: &lt;Your Database Username&gt;
Password: &lt;Your Database Password&gt; (should store in Vault)

Besides, if you need to access the AWS RDS Endpoint or EC2 instance, you will need to go through the VPC and configure inbound IP access. Therefore, you should add your IP address to the AWS account to obtain the necessary permissions for access. VPN tool can support this.

24
You need to login to do this manipulation!