--Install only the MySQL client on AWS EC2 (AMI: Amazon Linux 2) and connect to MySQL on RDS
--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!
--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
--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
$ 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)
--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)
-I installed 4 versions of MySQL client on Amazon Linux2. With Ansible Playbook
Recommended Posts