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?

Amazon Linux 2023上でMySQLクライアントを使ってRDSに接続する方法

Posted at

環境

  • EC2
    • OS: Amazon Linux 2023
    • RDSと接続済み
  • RDS
    • エンジン: MySQL Community
    • バージョン: 8.0.41
  • EC2インスタンスは起動済みであること

MySQLをEC2にインストール

最新のMySQLリポジトリを確認してインストール

sudo dnf -y install https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm

MySQLクライアントのみをインストール(mysqlコマンドが使えるようになり、RDSなど外部のMySQLサーバーに接続可能になります)

sudo dnf -y install mysql mysql-community-client

MySQLのバージョン確認をすることで、MySQLがインストールされたかを確認します

mysql --version

EC2からMySQLに接続

$ mysql -h <RDSのエンドポイント> -u <ユーザー名> -p
mysql  Ver 8.4.5 for Linux on x86_64 (MySQL Community Server - GPL)

※ パスワードは入力後に求められます

まとめ

EC2上にMySQLクライアントをインストールすることで、RDSの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?