Contents

Connect Private RDS MYSQL With Workbench Locally

Contents

Connecting to an RDS MySQL Private Instance Locally with MySQL Workbench 🪵 🛠️ 🛢️

Connecting to an Amazon RDS MySQL private instance using MySQL Workbench involves a few prerequisites and careful configuration. This blog post will guide you through the process, ensuring a seamless connection for efficient database management.

Prerequisites 📜

Before we begin, ensure the following prerequisites are met:

1 - RDS MySQL Database Server Security Group: The security group should have a rule to open port 3306 for the EC2 server or Bastion host private IP.

2 - EC2 Instance with Public IP: Ensure your EC2 instance has a public IP address.

3 - SSH Key Stored Locally: Your SSH key should be saved on your local machine.

4 - MySQL Workbench Installed Locally: Follow the steps below to install MySQL Workbench on Ubuntu 22.04.

Installing MySQL Workbench on Ubuntu 22.04

1 Download MySQL Workbench:

  • Visit the MySQL Workbench download page and download the deb package.

  • This package will download into your Downloads directory.

2 Open Terminal and Install:

  • Navigate to the Downloads directory

     cd ~/Downloads
    
  • Install MySQL Workbench:

     sudo apt install ./mysql-workbench-community_8.0.36-1ubuntu22.04_amd64.deb
    

3 Ensure MySQL Server is Installed:

  • If MySQL Server is not already installed, install it using:

    sudo apt install mysql-server
    

Configuring MySQL Workbench

Once MySQL Workbench is installed, follow these steps to configure the connection to your RDS

MySQL instance:

1 Open MySQL Workbench.

2 Create a New Connection:

  • Click the + button to create a new connection.

3 Connection Settings:

  • Connection Name: Enter a suitable name for your connection.

  • Connection Method: Select Standard TCP/IP over SSH.

4 SSH Configuration:

  • SSH Hostname: Enter your EC2 instance’s public IP followed by the port (e.g., ec2-public-ip:22).

  • SSH Username: Enter the username for your EC2 instance (e.g., ec2-user).

  • SSH Key File: Select the SSH key file stored locally.

5 MySQL Configuration:

  • MySQL Hostname: Enter the RDS endpoint (hostname).

  • MySQL Server Port: The default is 3306, but ensure it matches your instance configuration.

  • Username: Enter the RDS instance username.

  • Password: Click on Store in Keychain to securely save your database password.

6 Test the Connection:

  • Click on Test Connection to verify that the configuration is correct and the connection is successful.

7 Save and Connect:

  • Once the test connection is successful, click OK to save the connection.

  • Click on the saved connection to open it and start managing your RDS MySQL database.

https://github.com/yahyagulshan/linuxnotes/assets/59036269/529dead1-6423-4b72-b0c5-b9f8848befec

https://github.com/yahyagulshan/linuxnotes/assets/59036269/bae74a21-1420-4012-af6d-ed4111219ba3

Conclusion

Connecting to an RDS MySQL private instance from MySQL Workbench involves configuring your EC2 instance, security groups, and MySQL Workbench correctly. By following the steps outlined above, you can establish a secure connection and manage your databases efficiently. Happy database management!