Amazon Linux 2에 MySQL 8 설치하기
2020-10-07
.
Data_Engineering_TIL(20201007)
-
“How To Install MySQL 8 on Amazon Linux 2” 블로그 글을 보고 실습한 학습자료 입니다.
** URL : https://techviewleo.com/how-to-install-mysql-8-on-amazon-linux-2/
[실습내용]
- Step 1: Add MySQL Yum Repository to Amazon Linux 2
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
2 package(s) needed for security, out of 13 available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-1-10-81 ~]$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
[ec2-user@ip-10-1-10-81 ~]$ sudo yum update -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package awscli.noarch 0:1.18.107-1.amzn2.0.1 will be updated
---> Package awscli.noarch 0:1.18.147-1.amzn2.0.1 will be an update
---> Package ec2-net-utils.noarch 0:1.4-2.amzn2 will be updated
---> Package ec2-net-utils.noarch 0:1.4-3.amzn2 will be an update
---> Package kernel.x86_64 0:4.14.198-152.320.amzn2 will be installed
---> Package kernel-tools.x86_64 0:4.14.193-149.317.amzn2 will be updated
---> Package kernel-tools.x86_64 0:4.14.198-152.320.amzn2 will be an update
---> Package p11-kit.x86_64 0:0.23.19-1.amzn2 will be updated
---> Package p11-kit.x86_64 0:0.23.21-2.amzn2.0.1 will be an update
---> Package p11-kit-trust.x86_64 0:0.23.19-1.amzn2 will be updated
---> Package p11-kit-trust.x86_64 0:0.23.21-2.amzn2.0.1 will be an update
---> Package pam.x86_64 0:1.1.8-22.amzn2 will be updated
---> Package pam.x86_64 0:1.1.8-23.amzn2.0.1 will be an update
---> Package python2-botocore.noarch 0:1.17.31-1.amzn2.0.1 will be updated
---> Package python2-botocore.noarch 0:1.18.6-1.amzn2.0.1 will be an update
---> Package python2-rpm.x86_64 0:4.11.3-40.amzn2.0.4 will be updated
---> Package python2-rpm.x86_64 0:4.11.3-40.amzn2.0.5 will be an update
---> Package rpm.x86_64 0:4.11.3-40.amzn2.0.4 will be updated
---> Package rpm.x86_64 0:4.11.3-40.amzn2.0.5 will be an update
---> Package rpm-build-libs.x86_64 0:4.11.3-40.amzn2.0.4 will be updated
---> Package rpm-build-libs.x86_64 0:4.11.3-40.amzn2.0.5 will be an update
---> Package rpm-libs.x86_64 0:4.11.3-40.amzn2.0.4 will be updated
---> Package rpm-libs.x86_64 0:4.11.3-40.amzn2.0.5 will be an update
---> Package rpm-plugin-systemd-inhibit.x86_64 0:4.11.3-40.amzn2.0.4 will be updated
---> Package rpm-plugin-systemd-inhibit.x86_64 0:4.11.3-40.amzn2.0.5 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================
Installing:
kernel x86_64 4.14.198-152.320.amzn2 amzn2-core 21 M
Updating:
awscli noarch 1.18.147-1.amzn2.0.1 amzn2-core 2.1 M
ec2-net-utils noarch 1.4-3.amzn2 amzn2-core 17 k
kernel-tools x86_64 4.14.198-152.320.amzn2 amzn2-core 136 k
p11-kit x86_64 0.23.21-2.amzn2.0.1 amzn2-core 316 k
p11-kit-trust x86_64 0.23.21-2.amzn2.0.1 amzn2-core 128 k
pam x86_64 1.1.8-23.amzn2.0.1 amzn2-core 715 k
python2-botocore noarch 1.18.6-1.amzn2.0.1 amzn2-core 4.4 M
python2-rpm x86_64 4.11.3-40.amzn2.0.5 amzn2-core 84 k
rpm x86_64 4.11.3-40.amzn2.0.5 amzn2-core 1.2 M
rpm-build-libs x86_64 4.11.3-40.amzn2.0.5 amzn2-core 106 k
rpm-libs x86_64 4.11.3-40.amzn2.0.5 amzn2-core 275 k
rpm-plugin-systemd-inhibit x86_64 4.11.3-40.amzn2.0.5 amzn2-core 47 k
Transaction Summary
===============================================================================================================================================================================================================
Install 1 Package
Upgrade 12 Packages
Total download size: 30 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/13): ec2-net-utils-1.4-3.amzn2.noarch.rpm | 17 kB 00:00:00
(2/13): awscli-1.18.147-1.amzn2.0.1.noarch.rpm | 2.1 MB 00:00:00
(3/13): kernel-tools-4.14.198-152.320.amzn2.x86_64.rpm | 136 kB 00:00:00
(4/13): p11-kit-0.23.21-2.amzn2.0.1.x86_64.rpm | 316 kB 00:00:00
(5/13): p11-kit-trust-0.23.21-2.amzn2.0.1.x86_64.rpm | 128 kB 00:00:00
(6/13): pam-1.1.8-23.amzn2.0.1.x86_64.rpm | 715 kB 00:00:00
(7/13): python2-botocore-1.18.6-1.amzn2.0.1.noarch.rpm | 4.4 MB 00:00:00
(8/13): python2-rpm-4.11.3-40.amzn2.0.5.x86_64.rpm | 84 kB 00:00:00
(9/13): kernel-4.14.198-152.320.amzn2.x86_64.rpm | 21 MB 00:00:00
(10/13): rpm-4.11.3-40.amzn2.0.5.x86_64.rpm | 1.2 MB 00:00:00
(11/13): rpm-libs-4.11.3-40.amzn2.0.5.x86_64.rpm | 275 kB 00:00:00
(12/13): rpm-build-libs-4.11.3-40.amzn2.0.5.x86_64.rpm | 106 kB 00:00:00
(13/13): rpm-plugin-systemd-inhibit-4.11.3-40.amzn2.0.5.x86_64.rpm | 47 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 72 MB/s | 30 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : rpm-4.11.3-40.amzn2.0.5.x86_64 1/25
Updating : rpm-libs-4.11.3-40.amzn2.0.5.x86_64 2/25
Updating : rpm-build-libs-4.11.3-40.amzn2.0.5.x86_64 3/25
Updating : python2-botocore-1.18.6-1.amzn2.0.1.noarch 4/25
Updating : p11-kit-0.23.21-2.amzn2.0.1.x86_64 5/25
Updating : p11-kit-trust-0.23.21-2.amzn2.0.1.x86_64 6/25
Updating : awscli-1.18.147-1.amzn2.0.1.noarch 7/25
Updating : python2-rpm-4.11.3-40.amzn2.0.5.x86_64 8/25
Updating : rpm-plugin-systemd-inhibit-4.11.3-40.amzn2.0.5.x86_64 9/25
Updating : kernel-tools-4.14.198-152.320.amzn2.x86_64 10/25
Installing : kernel-4.14.198-152.320.amzn2.x86_64 11/25
Updating : pam-1.1.8-23.amzn2.0.1.x86_64 12/25
Updating : ec2-net-utils-1.4-3.amzn2.noarch 13/25
Cleanup : python2-rpm-4.11.3-40.amzn2.0.4.x86_64 14/25
Cleanup : awscli-1.18.107-1.amzn2.0.1.noarch 15/25
Cleanup : rpm-build-libs-4.11.3-40.amzn2.0.4.x86_64 16/25
Cleanup : p11-kit-trust-0.23.19-1.amzn2.x86_64 17/25
Cleanup : rpm-plugin-systemd-inhibit-4.11.3-40.amzn2.0.4.x86_64 18/25
Cleanup : python2-botocore-1.17.31-1.amzn2.0.1.noarch 19/25
Cleanup : ec2-net-utils-1.4-2.amzn2.noarch 20/25
Cleanup : rpm-libs-4.11.3-40.amzn2.0.4.x86_64 21/25
Cleanup : rpm-4.11.3-40.amzn2.0.4.x86_64 22/25
Cleanup : p11-kit-0.23.19-1.amzn2.x86_64 23/25
Cleanup : kernel-tools-4.14.193-149.317.amzn2.x86_64 24/25
Cleanup : pam-1.1.8-22.amzn2.x86_64 25/25
Verifying : p11-kit-0.23.21-2.amzn2.0.1.x86_64 1/25
Verifying : python2-rpm-4.11.3-40.amzn2.0.5.x86_64 2/25
Verifying : rpm-plugin-systemd-inhibit-4.11.3-40.amzn2.0.5.x86_64 3/25
Verifying : rpm-libs-4.11.3-40.amzn2.0.5.x86_64 4/25
Verifying : ec2-net-utils-1.4-3.amzn2.noarch 5/25
Verifying : pam-1.1.8-23.amzn2.0.1.x86_64 6/25
Verifying : python2-botocore-1.18.6-1.amzn2.0.1.noarch 7/25
Verifying : kernel-4.14.198-152.320.amzn2.x86_64 8/25
Verifying : rpm-4.11.3-40.amzn2.0.5.x86_64 9/25
Verifying : p11-kit-trust-0.23.21-2.amzn2.0.1.x86_64 10/25
Verifying : kernel-tools-4.14.198-152.320.amzn2.x86_64 11/25
Verifying : rpm-build-libs-4.11.3-40.amzn2.0.5.x86_64 12/25
Verifying : awscli-1.18.147-1.amzn2.0.1.noarch 13/25
Verifying : ec2-net-utils-1.4-2.amzn2.noarch 14/25
Verifying : rpm-4.11.3-40.amzn2.0.4.x86_64 15/25
Verifying : awscli-1.18.107-1.amzn2.0.1.noarch 16/25
Verifying : p11-kit-trust-0.23.19-1.amzn2.x86_64 17/25
Verifying : rpm-build-libs-4.11.3-40.amzn2.0.4.x86_64 18/25
Verifying : p11-kit-0.23.19-1.amzn2.x86_64 19/25
Verifying : pam-1.1.8-22.amzn2.x86_64 20/25
Verifying : kernel-tools-4.14.193-149.317.amzn2.x86_64 21/25
Verifying : rpm-libs-4.11.3-40.amzn2.0.4.x86_64 22/25
Verifying : rpm-plugin-systemd-inhibit-4.11.3-40.amzn2.0.4.x86_64 23/25
Verifying : python2-botocore-1.17.31-1.amzn2.0.1.noarch 24/25
Verifying : python2-rpm-4.11.3-40.amzn2.0.4.x86_64 25/25
Installed:
kernel.x86_64 0:4.14.198-152.320.amzn2
Updated:
awscli.noarch 0:1.18.147-1.amzn2.0.1 ec2-net-utils.noarch 0:1.4-3.amzn2 kernel-tools.x86_64 0:4.14.198-152.320.amzn2 p11-kit.x86_64 0:0.23.21-2.amzn2.0.1
p11-kit-trust.x86_64 0:0.23.21-2.amzn2.0.1 pam.x86_64 0:1.1.8-23.amzn2.0.1 python2-botocore.noarch 0:1.18.6-1.amzn2.0.1 python2-rpm.x86_64 0:4.11.3-40.amzn2.0.5
rpm.x86_64 0:4.11.3-40.amzn2.0.5 rpm-build-libs.x86_64 0:4.11.3-40.amzn2.0.5 rpm-libs.x86_64 0:4.11.3-40.amzn2.0.5 rpm-plugin-systemd-inhibit.x86_64 0:4.11.3-40.amzn2.0.5
Complete!
[ec2-user@ip-10-1-10-81 ~]$ sudo yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
mysql80-community-release-el7-3.noarch.rpm | 25 kB 00:00:00
Examining /var/tmp/yum-root-tXmdeb/mysql80-community-release-el7-3.noarch.rpm: mysql80-community-release-el7-3.noarch
Marking /var/tmp/yum-root-tXmdeb/mysql80-community-release-el7-3.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql80-community-release.noarch 0:el7-3 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================
Installing:
mysql80-community-release noarch el7-3 /mysql80-community-release-el7-3.noarch 31 k
Transaction Summary
===============================================================================================================================================================================================================
Install 1 Package
Total size: 31 k
Installed size: 31 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql80-community-release-el7-3.noarch 1/1
Verifying : mysql80-community-release-el7-3.noarch 1/1
Installed:
mysql80-community-release.noarch 0:el7-3
Complete!
[ec2-user@ip-10-1-10-81 ~]$ ls /etc/yum.repos.d
amzn2-core.repo amzn2-extras.repo mysql-community.repo mysql-community-source.repo
[ec2-user@ip-10-1-10-81 ~]$ sudo yum repolist
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
35 packages excluded due to repository priority protections
repo id repo name status
!amzn2-core/2/x86_64 Amazon Linux 2 core repository 21,106
amzn2extra-docker/2/x86_64 Amazon Extras repo for docker 28
mysql-connectors-community/x86_64 MySQL Connectors Community 130+35
mysql-tools-community/x86_64 MySQL Tools Community 115
mysql80-community/x86_64 MySQL 8.0 Community Server 193
repolist: 21,572
- Step 2: Install MySQL 8 on Amazon Linux 2
[ec2-user@ip-10-1-10-81 ~]$ sudo yum install mysql-community-server -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
35 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.21-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.21-1.el7 for package: mysql-community-server-8.0.21-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.21-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.21-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.21-1.el7.x86_64
--> Processing Dependency: libtinfo.so.5()(64bit) for package: mysql-community-client-8.0.21-1.el7.x86_64
--> Processing Dependency: libncurses.so.5()(64bit) for package: mysql-community-client-8.0.21-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:8.0.21-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.64-1.amzn2 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.amzn2.0.3.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.amzn2.0.3.x86_64
---> Package mysql-community-libs.x86_64 0:8.0.21-1.el7 will be obsoleting
---> Package ncurses-compat-libs.x86_64 0:6.0-8.20170212.amzn2.1.3 will be installed
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:8.0.21-1.el7 will be obsoleting
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================
Installing:
mysql-community-libs x86_64 8.0.21-1.el7 mysql80-community 4.5 M
replacing mariadb-libs.x86_64 1:5.5.64-1.amzn2
mysql-community-libs-compat x86_64 8.0.21-1.el7 mysql80-community 1.2 M
replacing mariadb-libs.x86_64 1:5.5.64-1.amzn2
mysql-community-server x86_64 8.0.21-1.el7 mysql80-community 499 M
Installing for dependencies:
mysql-community-client x86_64 8.0.21-1.el7 mysql80-community 48 M
mysql-community-common x86_64 8.0.21-1.el7 mysql80-community 617 k
ncurses-compat-libs x86_64 6.0-8.20170212.amzn2.1.3 amzn2-core 308 k
Transaction Summary
===============================================================================================================================================================================================================
Install 3 Packages (+3 Dependent packages)
Total download size: 553 M
Downloading packages:
warning: /var/cache/yum/x86_64/2/mysql80-community/packages/mysql-community-common-8.0.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-8.0.21-1.el7.x86_64.rpm is not installed
(1/6): mysql-community-common-8.0.21-1.el7.x86_64.rpm | 617 kB 00:00:00
(2/6): mysql-community-libs-8.0.21-1.el7.x86_64.rpm | 4.5 MB 00:00:00
(3/6): mysql-community-libs-compat-8.0.21-1.el7.x86_64.rpm | 1.2 MB 00:00:00
(4/6): ncurses-compat-libs-6.0-8.20170212.amzn2.1.3.x86_64.rpm | 308 kB 00:00:00
(5/6): mysql-community-client-8.0.21-1.el7.x86_64.rpm | 48 MB 00:00:00
(6/6): mysql-community-server-8.0.21-1.el7.x86_64.rpm | 499 MB 00:00:03
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 159 MB/s | 553 MB 00:00:03
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
Package : mysql80-community-release-el7-3.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql-community-common-8.0.21-1.el7.x86_64 1/7
Installing : mysql-community-libs-8.0.21-1.el7.x86_64 2/7
Installing : ncurses-compat-libs-6.0-8.20170212.amzn2.1.3.x86_64 3/7
Installing : mysql-community-client-8.0.21-1.el7.x86_64 4/7
Installing : mysql-community-server-8.0.21-1.el7.x86_64 5/7
Installing : mysql-community-libs-compat-8.0.21-1.el7.x86_64 6/7
Erasing : 1:mariadb-libs-5.5.64-1.amzn2.x86_64 7/7
Verifying : mysql-community-server-8.0.21-1.el7.x86_64 1/7
Verifying : ncurses-compat-libs-6.0-8.20170212.amzn2.1.3.x86_64 2/7
Verifying : mysql-community-libs-8.0.21-1.el7.x86_64 3/7
Verifying : mysql-community-client-8.0.21-1.el7.x86_64 4/7
Verifying : mysql-community-libs-compat-8.0.21-1.el7.x86_64 5/7
Verifying : mysql-community-common-8.0.21-1.el7.x86_64 6/7
Verifying : 1:mariadb-libs-5.5.64-1.amzn2.x86_64 7/7
Installed:
mysql-community-libs.x86_64 0:8.0.21-1.el7 mysql-community-libs-compat.x86_64 0:8.0.21-1.el7 mysql-community-server.x86_64 0:8.0.21-1.el7
Dependency Installed:
mysql-community-client.x86_64 0:8.0.21-1.el7 mysql-community-common.x86_64 0:8.0.21-1.el7 ncurses-compat-libs.x86_64 0:6.0-8.20170212.amzn2.1.3
Replaced:
mariadb-libs.x86_64 1:5.5.64-1.amzn2
Complete!
다음과 같은 package 들이 설치된다.
1) MySQL server: mysql-community-server
2) MySQL client: mysql-community-client
- Step 3: Start and Configure MySQL 8 on Amazon Linux 2
[ec2-user@ip-10-1-10-81 ~]$ sudo systemctl enable --now mysqld
[ec2-user@ip-10-1-10-81 ~]$ systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-07 07:28:55 UTC; 8s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 11832 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 11906 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─11906 /usr/sbin/mysqld
Oct 07 07:28:50 ip-10-1-10-81.ap-northeast-2.compute.internal systemd[1]: Starting MySQL Server...
Oct 07 07:28:55 ip-10-1-10-81.ap-northeast-2.compute.internal systemd[1]: Started MySQL Server.
슈퍼유저인 root @ localhost 가 initial password로 세팅되어 error log file에 저장되어 있기 때문에 그거를 확인하기 위해 다음과 같은 명령어를 실행한다.
[ec2-user@ip-10-1-10-81 ~]$ sudo grep 'temporary password' /var/log/mysqld.log
2020-10-07T07:28:52.228023Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: F=u3q.9hf!>d
위에서 확인한 임시 루트비번을 갖고 MySQL 서버에서 최초 installation 설정을 해준다.
[ec2-user@ip-10-1-10-81 ~]$ sudo mysql_secure_installation -p'F=u3q.9hf!>d'
mysql_secure_installation: [Warning] Using a password on the command line interface can be insecure.
Securing the MySQL server deployment.
The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new password:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) :
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
여기까지 했으면 MySQL 설치가 완료된 것이다.
MySQL shell에서 루트 비번을 언제든지 업데이트 할 수 있다.
[ec2-user@ip-10-1-10-81 ~]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.21 MySQL Community Server - GPL
Copyright (c) 2000, 2020, 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.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewStrongP@ssw0d!';
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
[ec2-user@ip-10-1-10-81 ~]$ mysql -uroot -p
Enter password: # 위에서 변경한 MyNewStrongP@ssw0d! 로 입력
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.21 MySQL Community Server - GPL
Copyright (c) 2000, 2020, 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.
mysql> exit
Bye