LoginSignup
32
33

More than 5 years have passed since last update.

EC2からRDS(MySQL)への接続を行う

Last updated at Posted at 2018-07-12

EC2からRDSへの接続を行う手順になります
あらかじめRDSのDBインスタンスの作成をしている前提になりますのでご了承ください。

準備

Amazon RDSのDBインスタンスのセキュリティグループで、MySQLポートを開けておきましょう
スクリーンショット 2018-07-12 11.51.29.png

mariaDB削除

$ sudo yum remove mariadb-libs
$ sudo rm -rf /var/lib/mysql

mysqlがインストールされているか確認

$ yum list installed | grep mysql

mysqlインストール

$ sudo yum install mysql

Amazon RDSヘ接続する

$ mysql -h {ENDPOINT} -P 3306 -u {Username} –p {Name}
password: hogehoge
// こんなのが表示されれば成功
Server version: 5.6.39 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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.

番外編:アンインストール方法

yumでアンインストール処理を実施

$ yum remove mysql

データが入っているディレクトリを削除

$ rm -rf /var/lib/mysql
32
33
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
32
33