0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【基本】AWSでRDS(mysql)に接続してみた

Posted at

概要

AWSのRDSを使ってMySQLへ接続をしてみました。

前提事項

RDSの作成で行うパラメータ設定は、基本的にはすべてデフォルトで行っています。
また、接続方法はEC2インスタンスの踏み台サーバを使ってRDSへ接続します。

MySQLで接続してみる

EC2にMySQLクライアントを入れる

・mysql8.0がインストールされているか確認する

[root@ip-10-0-1-10 ~]# yum info mysql
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Error: No matching Packages to list

インストールできないのでmysql8.0のリポジトリを追加します

[root@ip-10-0-1-10 ~]# yum localinstall -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Installed:
  mysql80-community-release.noarch 0:el7-3                                      

Complete!

mysql8.0のリポジトリを有効化にしていきます

yum-config-manager --disable mysql57-community
yum-config-manager --enable mysql80-community

mysql-community-clientをインストールする

[root@ip-10-0-1-10 ~]# yum install -y mysql-community-client

Installed:
  mysql-community-client.x86_64 0:8.0.26-1.el7                                  
  mysql-community-libs.x86_64 0:8.0.26-1.el7                                    
  mysql-community-libs-compat.x86_64 0:8.0.26-1.el7                             

Dependency Installed:
  mysql-community-client-plugins.x86_64 0:8.0.26-1.el7                          
  mysql-community-common.x86_64 0:8.0.26-1.el7                                  
  ncurses-compat-libs.x86_64 0:6.0-8.20170212.amzn2.1.3                         

Replaced:
  mariadb-libs.x86_64 1:5.5.68-1.amzn2                                          

Complete!

RDSへ接続する

[root@ip-10-0-1-10 ~]# mysql -h database-1.c5jqncbegdvz.ap-northeast-1.rds.amazonaws.com -P 3306 -u admin -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.23 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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>

参考

MySQLクライアントで接続する方法

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?