[AWS EC2] How to install only MySQL client on Amazon Linux 2 and connect to RDS

Overview

--Install only the MySQL client on AWS EC2 (AMI: Amazon Linux 2) and connect to MySQL on RDS

environment

Construction procedure

1. Remove the already installed mariadb

--MariaDB is installed by default on Amazon Linux 2 ――It will be a problem if you interfere, so delete it just in case

$ yum list installed | grep mariadb
mariadb-libs.x86_64                   1:5.5.64-1.amzn2               installed
$ sudo yum remove mariadb-libs
Removed:
  mariadb-libs.x86_64 1:5.5.64-1.amzn2
Dependency Removed:
  postfix.x86_64 2:2.10.1-6.amzn2.0.3
Complete!

2. Add the mysql8.0 repository

--Check if mysql8.0 can be installed with yum info --Cannot install, so add mysql8.0 repository

$ yum info mysql
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
31 packages excluded due to repository priority protections
Error: No matching Packages to list

$ sudo yum localinstall -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
Installed:
  mysql80-community-release.noarch 0:el7-3

3. Enable the mysql8.0 repository

--mysql5.7 is also included in mysql80-community-release-el7-3.noarch --I want to install mysql8.0 this time --Disable the mysql5.7 repository and enable the mysql8.0 repository

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

4. Install mysql-community-client

$ sudo yum install -y mysql-community-client
Installed:
  mysql-community-client.x86_64 0:8.0.19-1.el7
Dependency Installed:
  mysql-community-common.x86_64 0:8.0.19-1.el7                               mysql-community-libs.x86_64 0:8.0.19-1.el7
  ncurses-compat-libs.x86_64 0:6.0-8.20170212.amzn2.1.3
Complete!

$ mysql --version
mysql  Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)

5. Connect to RDS

--It is assumed that communication on port 3306 from EC2 to RDS is permitted.

$ mysql -h hoge.rds.amazonaws.com -P 3306 -u root -p
Enter password:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.03 sec)

reference

-I installed 4 versions of MySQL client on Amazon Linux2. With Ansible Playbook

Recommended Posts

[AWS EC2] How to install only MySQL client on Amazon Linux 2 and connect to RDS
[AWS EC2] How to install Maven on Amazon Linux 2
How to install Anisble on Amazon Linux 2
[2020 version] How to install Python3 on AWS EC2
How to install git on Linux such as EC2
[AWS] How to expand disk space on Amazon linux
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
Install pyenv on EC2 (Amazon Linux)
[AWS EC2] Settings you want to do on Amazon Linux 2
How to install pandas on EC2 (How to deal with MemoryError and PermissionError)
I'll install Ruby on EC2 (Amazon Linux2) 2020
How to install aws-session-manager-plugin on Manajro Linux
How to update php on Amazon linux 2
Upgraded mysql on Cloud9 (Amazon Linux) (5.5 to 5,7)
How to install packages on Alpine Linux
How to install php7.4 on Linux (Ubuntu)
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Install Python3 and Django on Amazon Linux (EC2) and run your web server
How to install Camunda Modeler on Manjaro Linux
Create Amazon Linux with AWS EC2 and log in
How to install Linux on a 32bit UEFI PC
How to install Git GUI and Gitk on CentOS
AWS EC2 2nd SSH connection to EC2 Instance (Amazon Linux2)
MySQL installation on Aws Linux 2 and test data preparation
Compile and install MySQL-python for python2.7 on amazon linux
How to build a Python environment on amazon linux 2
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
Install tomcat 5.5 on Amazon Linux.
Install Homebrew on Amazon Linux 2
Install LAMP on Amazon Linux 2 and build a WordPress environment.
Launch NEM Symbol testnet node on AWS EC2 (Amazon Linux2)
Steps to install MySQL 8.0 on CentOS 8.1
How to install OpenCV on Cloud9 and run it in Python
Install oracle java8 on amazon linux2
How to install mysql-connector-python on mac
How to install and use Tesseract-OCR
[EC2] How to install chrome and the contents of each command
Install Ubuntu 18.04 on MacBook Pro Touchbar model and connect to WIFI
How to install graph-tool on macOS
How to install pycrypto on Windows
How to install MBDyn (Linux Ubuntu)
How to install PyPy on CentOS
[EC2] How to install and download chromedriver from the command line
Misunderstanding on how to connect cnn
How to install TensorFlow on CentOS 7
How to install and configure blackbird
How to install CUDA and nvidia-driver
Summary of installing PHP7.2 on EC2 (Amazon Linux 2) and setting php.ini
How to install and use Graphviz
[Note] Install Imagick on Amazon Linux2
How to install Maven on CentOS
How to install Go on Ubuntu
How to install music 21 on windows
A story I was addicted to trying to install LightFM on Amazon Linux
How to set up a jupyter notebook on ssh destination (AWS EC2)
Build Linux on a Windows environment. Steps to install Laradock and migrate
[Linux] How to subdivide files and folders
How to install drobertadams / toggl-cli on Mac
How to install and use pandas_datareader [Python]
[Kivy] How to install Kivy on Windows [Python]