- MySQL Upgrade from 5.6 to 5.7 to 8.0
- 4. Switch to root user
- 5. Install Server updates
- 6. Install wget package
- 6. Install MySQL 5.6
- 7. Upgrade MySQL from 5.6 to 5.7
- Check the Status of MySQL
- Stop the Service of MySQL 5.6
- Check the Status of MySQL
- Take Backup of MySQL Database 5.6
- Remove Binaries of MySQL 5.6
- Download Binaries of MySQL 5.7 (RPM)
- Install Binareis of MySQL 5.7 (RPM)
- Install MySQL 5.7
- Check Version of MySQL
- Start the Service of MySQL
- Check the Status of MySQL
- Connect to MySQL 5.7 Database
- Check the version of MySQL 5.7 Database
- Upgrading the MySQL 5.7 Database
- Setting the root Password
- Connect to MySQL 5.7 Database
- Check the version of MySQL 5.7 Database
- 8. Upgrade MySQL from 5.7 to 8.0
- Check the Status of MySQL
- Install MySQL Shell
- Check the migration issues of Database data
- Stop the Service of MySQL 5.6
- Check the Status of MySQL
- Remove Binaries of MySQL 5.7
- Download Binaries of MySQL 8.0 (RPM)
- Install Binareis of MySQL 8.0 (RPM)
- Install MySQL 8.0
- Check Version of MySQL
- Start the Service of MySQL
- Check the Status of MySQL
- Connect to MySQL 8.0 Database
- Check the version of MySQL 8.0 Database
- Setting the root Password
- Connect to MySQL 8.0 Database
- Check the version of MySQL 8.0 Database
https://www.ktexperts.com/mysql-upgrade-from-5-6-to-5-7-to-8-0/ 文章出处
MySQL Upgrade from 5.6 to 5.7 to 8.0
Posted on January 6, 2021 in MySQL Installation & Upgrade
Post Views: 5,509
4. Switch to root user
[ec2-user@ip-172-31-41-7~]$sudo su [root@ip-172-31-41-7ec2-user]# |
---|
5. Install Server updates
[root@ip-172-31-41-7ec2-user]# yum update -y Red Hat Update Infrastructure3Client Configuration Server8 14kB/s|3.5kB 00:00 Red Hat Enterprise Linux8forx86_64-AppStream from RHUI(RPMs) 39MB/s| 25MB 00:00 Red Hat Enterprise Linux8forx86_64-BaseOS from RHUI(RPMs) 43MB/s| 26MB 00:00 Dependencies resolved. ============================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================== Installing: kernel x86_64 4.18.0-240.8.1.el8_3 rhel-8-baseos-rhui-rpms 4.3M kernel-core x86_64 4.18.0-240.8.1.el8_3 rhel-8-baseos-rhui-rpms 30M kernel-modules x86_64 4.18.0-240.8.1.el8_3 rhel-8-baseos-rhui-rpms 26M Upgrading: NetworkManager x86_64 1:1.26.0-12.el8_3 rhel-8-baseos-rhui-rpms 2.4M NetworkManager-libnm x86_64 1:1.26.0-12.el8_3 rhel-8-baseos-rhui-rpms 1.8M NetworkManager-team x86_64 1:1.26.0-12.el8_3 rhel-8-baseos-rhui-rpms 142k NetworkManager-tui x86_64 1:1.26.0-12.el8_3 rhel-8-baseos-rhui-rpms 320k cloud-init noarch 19.4-11.el8_3.1 rhel-8-appstream-rhui-rpms 945k curl x86_64 7.61.1-14.el8_3.1 rhel-8-baseos-rhui-rpms 353k freetype x86_64 2.9.1-4.el8_3.1 rhel-8-baseos-rhui-rpms 394k gnutls x86_64 3.6.14-7.el8_3 rhel-8-baseos-rhui-rpms 1.0M insights-client noarch 3.1.1-1.el8_3 rhel-8-appstream-rhui-rpms 1.0M iptables-libs x86_64 1.8.4-15.el8_3.3 rhel-8-baseos-rhui-rpms 106k kernel-tools x86_64 4.18.0-240.8.1.el8_3 rhel-8-baseos-rhui-rpms 4.5M kernel-tools-libs x86_64 4.18.0-240.8.1.el8_3 rhel-8-baseos-rhui-rpms 4.3M kexec-tools x86_64 2.0.20-34.el8_3.1 rhel-8-baseos-rhui-rpms 496k libcurl x86_64 7.61.1-14.el8_3.1 rhel-8-baseos-rhui-rpms 299k microcode_ctl x86_64 4:20200609-2.20201112.1.el8_3 rhel-8-baseos-rhui-rpms 4.6M openssl x86_64 1:1.1.1g-12.el8_3 rhel-8-baseos-rhui-rpms 707k openssl-libs x86_64 1:1.1.1g-12.el8_3 rhel-8-baseos-rhui-rpms 1.5M python3-perf x86_64 4.18.0-240.8.1.el8_3 rhel-8-baseos-rhui-rpms 4.4M qemu-guest-agent x86_64 15:4.2.0-34.module+el8.3.0+8829+e7a0a3ea.1 rhel-8-appstream-rhui-rpms 228k systemd x86_64 239-41.el8_3.1 rhel-8-baseos-rhui-rpms 3.5M systemd-libs x86_64 239-41.el8_3.1 rhel-8-baseos-rhui-rpms 1.1M systemd-pam x86_64 239-41.el8_3.1 rhel-8-baseos-rhui-rpms 456k systemd-udev x86_64 239-41.el8_3.1 rhel-8-baseos-rhui-rpms 1.3M tuned noarch 2.14.0-3.el8_3.1 rhel-8-baseos-rhui-rpms 292k Installing dependencies: linux-firmware noarch 20200619-101.git3890db36.el8_3 rhel-8-baseos-rhui-rpms 101M Transaction Summary ============================================================================================================================================================================================================== Install 4Packages Upgrade 24Packages Total download size:198M Downloading Packages: (1/28):kernel-4.18.0-240.8.1.el8_3.x86_64.rpm 15MB/s|4.3MB 00:00 (2/28):kernel-core-4.18.0-240.8.1.el8_3.x86_64.rpm 33MB/s| 30MB 00:00 (3/28):kernel-modules-4.18.0-240.8.1.el8_3.x86_64.rpm 22MB/s| 26MB 00:01 (4/28):cloud-init-19.4-11.el8_3.1.noarch.rpm 3.6MB/s|945kB 00:00 (5/28):qemu-guest-agent-4.2.0-34.module+el8.3.0+8829+e7a0a3ea.1.x86_64.rpm 1.9MB/s|228kB 00:00 (6/28):insights-client-3.1.1-1.el8_3.noarch.rpm 6.8MB/s|1.0MB 00:00 (7/28):NetworkManager-team-1.26.0-12.el8_3.x86_64.rpm 1.3MB/s|142kB 00:00 (8/28):freetype-2.9.1-4.el8_3.1.x86_64.rpm 3.1MB/s|394kB 00:00 ——————————————————————————————————————————————————————————————————————————————————————————————————————— Total 64MB/s|198MB 00:03 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet:systemd-libs-239-41.el8_3.1.x86_64 1/1 Upgrading :systemd-libs-239-41.el8_3.1.x86_64 1/52 Running scriptlet:systemd-libs-239-41.el8_3.1.x86_64 1/52 Upgrading :gnutls-3.6.14-7.el8_3.x86_64 2/52 Upgrading :openssl-libs-1:1.1.1g-12.el8_3.x86_64 3/52 Running scriptlet:openssl-libs-1:1.1.1g-12.el8_3.x86_64 3/52 Upgrading :libcurl-7.61.1-14.el8_3.1.x86_64 4/52 Upgrading :NetworkManager-libnm-1:1.26.0-12.el8_3.x86_64 5/52 Running scriptlet:NetworkManager-libnm-1:1.26.0-12.el8_3.x86_64 5/52 Upgrading :iptables-libs-1.8.4-15.el8_3.3.x86_64 6/52 Running scriptlet:systemd-239-41.el8_3.1.x86_64 7/52 Upgrading :systemd-239-41.el8_3.1.x86_64 7/52 Running scriptlet:systemd-239-41.el8_3.1.x86_64 7/52 Upgrading :systemd-pam-239-41.el8_3.1.x86_64 8/52 Verifying :kernel-modules-4.18.0-240.8.1.el8_3.x86_64 1/52 Verifying :kernel-core-4.18.0-240.8.1.el8_3.x86_64 2/52 Verifying :kernel-4.18.0-240.8.1.el8_3.x86_64 3/52 Verifying :linux-firmware-20200619-101.git3890db36.el8_3.noarch 4/52 Verifying :cloud-init-19.4-11.el8_3.1.noarch 5/52 Verifying :cloud-init-19.4-11.el8.noarch 6/52 Verifying :insights-client-3.1.1-1.el8_3.noarch 7/52 Verifying :insights-client-3.1.0-3.el8.noarch 8/52 Upgraded: NetworkManager-1:1.26.0-12.el8_3.x86_64 NetworkManager-libnm-1:1.26.0-12.el8_3.x86_64 NetworkManager-team-1:1.26.0-12.el8_3.x86_64 NetworkManager-tui-1:1.26.0-12.el8_3.x86_64 cloud-init-19.4-11.el8_3.1.noarch curl-7.61.1-14.el8_3.1.x86_64 freetype-2.9.1-4.el8_3.1.x86_64 gnutls-3.6.14-7.el8_3.x86_64 insights-client-3.1.1-1.el8_3.noarch iptables-libs-1.8.4-15.el8_3.3.x86_64 kernel-tools-4.18.0-240.8.1.el8_3.x86_64 kernel-tools-libs-4.18.0-240.8.1.el8_3.x86_64 kexec-tools-2.0.20-34.el8_3.1.x86_64 libcurl-7.61.1-14.el8_3.1.x86_64 microcode_ctl-4:20200609-2.20201112.1.el8_3.x86_64 openssl-1:1.1.1g-12.el8_3.x86_64 openssl-libs-1:1.1.1g-12.el8_3.x86_64 python3-perf-4.18.0-240.8.1.el8_3.x86_64 qemu-guest-agent-15:4.2.0-34.module+el8.3.0+8829+e7a0a3ea.1.x86_64 systemd-239-41.el8_3.1.x86_64 systemd-libs-239-41.el8_3.1.x86_64 systemd-pam-239-41.el8_3.1.x86_64 systemd-udev-239-41.el8_3.1.x86_64 tuned-2.14.0-3.el8_3.1.noarch Installed: kernel-4.18.0-240.8.1.el8_3.x86_64 kernel-core-4.18.0-240.8.1.el8_3.x86_64 kernel-modules-4.18.0-240.8.1.el8_3.x86_64 linux-firmware-20200619-101.git3890db36.el8_3.noarch Complete! |
---|
6. Install wget package
[root@ip-172-31-41-7ec2-user]# yum install wget -y Last metadata expiration check:0:04:39ago on Mon28Dec202008:06:57AM UTC. Dependencies resolved. ============================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================== Installing: wget x86_64 1.19.5-10.el8 rhel-8-appstream-rhui-rpms 734k Transaction Summary ============================================================================================================================================================================================================== Install 1Package Total download size:734k Installed size:2.8M Downloading Packages: wget-1.19.5-10.el8.x86_64.rpm 5.0MB/s|734kB 00:00 ——————————————————————————————————————————————————————————————————————————————————————————————————————— Total 3.9MB/s|734kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing :wget-1.19.5-10.el8.x86_64 1/1 Running scriptlet:wget-1.19.5-10.el8.x86_64 1/1 Verifying :wget-1.19.5-10.el8.x86_64 1/1 Installed: wget-1.19.5-10.el8.x86_64 Complete! |
---|
6. Install MySQL 5.6
We can install MySQL 5.6 by using below link.
Install MySQL 5.6
7. Upgrade MySQL from 5.6 to 5.7
Check the Status of MySQL
[root@ip-172-31-41-7ec2-user]# service mysqld start Redirecting to/bin/systemctl start mysqld.service [root@ip-172-31-41-7ec2-user]# service mysqld status Redirecting to/bin/systemctl status mysqld.service ●mysqld.service-MySQL Community Server Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendor preset:disabled) Active:active(running)since Mon2020-12-2808:22:56UTC;4sago Process:58906ExecStartPost=/usr/bin/mysql-systemd-start post(code=exited,status=0/SUCCESS) Process:58846ExecStartPre=/usr/bin/mysql-systemd-start pre(code=exited,status=0/SUCCESS) Main PID:58905(mysqld_safe) Tasks:23(limit:4836) Memory:493.3M CGroup:/system.slice/mysqld.service ├─58905/bin/sh/usr/bin/mysqld_safe—basedir=/usr └─59080/usr/sbin/mysqld—basedir=/usr—datadir=/var/lib/mysql—plugin-dir=/usr/lib64/mysql/plugin—log-error=/var/log/mysqld.log—pid-file=/var/run/mysqld/mysqld.pid—socket=/var/lib/mysq> |
---|
Stop the Service of MySQL 5.6
[root@ip-172-31-41-7ec2-user]# service mysqld stop Redirecting to/bin/systemctl stop mysqld.service |
---|
Check the Status of MySQL
[root@ip-172-31-41-7ec2-user]# service mysqld status Redirecting to/bin/systemctl status mysqld.service ●mysqld.service-MySQL Community Server Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendor preset:disabled) Active:inactive(dead)since Mon2020-12-2808:32:29UTC;2sago Process:59177ExecStartPost=/usr/bin/mysql-systemd-start post(code=exited,status=0/SUCCESS) Process:59176ExecStart=/usr/bin/mysqld_safe—basedir=/usr(code=exited,status=0/SUCCESS) Process:59164ExecStartPre=/usr/bin/mysql-systemd-start pre(code=exited,status=0/SUCCESS) Main PID:59176(code=exited,status=0/SUCCESS) Dec2808:26:58ip-172-31-41-7.ap-south-1.compute.internalsystemd[1]:Starting MySQL Community Server… Dec2808:26:58ip-172-31-41-7.ap-south-1.compute.internalmysqld_safe[59176]:20122808:26:58mysqld_safe Logging to’/var/log/mysqld.log’. Dec2808:26:58ip-172-31-41-7.ap-south-1.compute.internalmysqld_safe[59176]:20122808:26:58mysqld_safe Starting mysqld daemon with databases from/var/lib/mysql Dec2808:26:59ip-172-31-41-7.ap-south-1.compute.internalsystemd[1]:Started MySQL Community Server. |
---|
Take Backup of MySQL Database 5.6
[root@ip-172-31-41-7ec2-user]# cp -r /var/lib/mysql /tmp [root@ip-172-31-41-7ec2-user]# cd /tmp [root@ip-172-31-41-7tmp]# ls mysql systemd-private-573e2cde6da64d8d896e39e7124b0a7e-chronyd.service-qrjFEf [root@ip-172-31-41-7tmp]# cd mysql/ [root@ip-172-31-41-7mysql]# ll total110604 -rw-r——-.1root root 56Dec2808:35auto.cnf -rw-r——-.1root root12582912Dec2808:35ibdata1 -rw-r——-.1root root50331648Dec2808:35ib_logfile0 -rw-r——-.1root root50331648Dec2808:35ib_logfile1 drwx———.2root root 4096Dec2808:35mysql drwx———.2root root 4096Dec2808:35performance_schema |
---|
Remove Binaries of MySQL 5.6
[root@ip-172-31-41-7ec2-user]# yum remove mysql-community-server* Dependencies resolved. ============================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================== Removing: mysql-community-server x86_64 5.6.50-2.el7 @mysql56-community 268M Removing unused dependencies: libaio x86_64 0.3.112-1.el8 @rhel-8-baseos-rhui-rpms 93k mysql-community-client x86_64 5.6.50-2.el7 @mysql56-community 83M mysql-community-common x86_64 5.6.50-2.el7 @mysql56-community 2.3M mysql-community-libs x86_64 5.6.50-2.el7 @mysql56-community 9.1M ncurses-compat-libs x86_64 6.1-7.20180224.el8 @rhel-8-baseos-rhui-rpms 1.2M perl-Carp noarch 1.42-396.el8 @rhel-8-baseos-rhui-rpms 41k perl-DBI x86_64 1.641-3.module+el8.3.0+6481+fbe55708 @rhel-8-appstream-rhui-rpms 1.8M perl-Data-Dumper x86_64 2.167-399.el8 @rhel-8-baseos-rhui-rpms 104k perl-Digest noarch 1.17-395.el8 @rhel-8-appstream-rhui-rpms 26k perl-Digest-MD5 x86_64 2.55-396.el8 @rhel-8-appstream-rhui-rpms 55k perl-Encode x86_64 4:2.97-3.el8 @rhel-8-baseos-rhui-rpms 9.7M perl-Errno x86_64 1.28-416.el8 @rhel-8-baseos-rhui-rpms 9.3k perl-Exporter noarch 5.72-396.el8 @rhel-8-baseos-rhui-rpms 54k Transaction Summary ============================================================================================================================================================================================================== Remove 50Packages Freed space:401M Isthisok[y/N]:y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet:mysql-community-server-5.6.50-2.el7.x86_64 1/1 Running scriptlet:mysql-community-server-5.6.50-2.el7.x86_64 1/50 Erasing :mysql-community-server-5.6.50-2.el7.x86_64 1/50 Running scriptlet:mysql-community-server-5.6.50-2.el7.x86_64 1/50 Erasing :perl-DBI-1.641-3.module+el8.3.0+6481+fbe55708.x86_64 2/50 Erasing :perl-Math-BigInt-1:1.9998.11-7.el8.noarch 3/50 Erasing :mysql-community-client-5.6.50-2.el7.x86_64 4/50 Erasing :perl-libnet-3.11-3.el8.noarch 5/50 Erasing :perl-URI-1.73-3.el8.noarch 6/50 Erasing :perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch 7/50 Erasing :perl-HTTP-Tiny-0.074-1.el8.noarch 8/50 Verifying :libaio-0.3.112-1.el8.x86_64 1/50 Verifying :mysql-community-client-5.6.50-2.el7.x86_64 2/50 Verifying :mysql-community-common-5.6.50-2.el7.x86_64 3/50 Verifying :mysql-community-libs-5.6.50-2.el7.x86_64 4/50 Verifying :mysql-community-server-5.6.50-2.el7.x86_64 5/50 Verifying :ncurses-compat-libs-6.1-7.20180224.el8.x86_64 6/50 Verifying :perl-Carp-1.42-396.el8.noarch 7/50 Verifying :perl-DBI-1.641-3.module+el8.3.0+6481+fbe55708.x86_64 8/50 Removed: libaio-0.3.112-1.el8.x86_64 mysql-community-client-5.6.50-2.el7.x86_64 mysql-community-common-5.6.50-2.el7.x86_64 mysql-community-libs-5.6.50-2.el7.x86_64 mysql-community-server-5.6.50-2.el7.x86_64 ncurses-compat-libs-6.1-7.20180224.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-DBI-1.641-3.module+el8.3.0+6481+fbe55708.x86_64 perl-Data-Dumper-2.167-399.el8.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch perl-MIME-Base64-3.15-396.el8.x86_64 perl-Math-BigInt-1:1.9998.11-7.el8.noarch perl-Math-Complex-1.59-416.el8.noarch perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64 perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-3.el8.x86_64 perl-Storable-1:3.11-3.el8.x86_64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-URI-1.73-3.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libnet-3.11-3.el8.noarch perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 Complete! |
---|
Download Binaries of MySQL 5.7 (RPM)
[root@ip-172-31-41-7ec2-user]# wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm —2020-12-2808:38:59— https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm Resolving dev.mysql.com(dev.mysql.com)…137.254.60.11 Connecting todev.mysql.com(dev.mysql.com)|137.254.60.11|:443…connected. HTTP request sent,awaiting response…302Found Location:https://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm [following] —2020-12-2808:39:00— https://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm Resolving repo.mysql.com(repo.mysql.com)…104.120.171.24 Connecting torepo.mysql.com(repo.mysql.com)|104.120.171.24|:443…connected. HTTP request sent,awaiting response…200OK Length:9224(9.0K)[application/x-redhat-package-manager] Saving to:‘mysql57-community-release-el7-9.noarch.rpm’ mysql57-community-release-el7-9.noarch.rpm 100%[=================================================================================================================>] 9.01K —.-KB/s in0s 2020-12-2808:39:00(193MB/s)-‘mysql57-community-release-el7-9.noarch.rpm’saved[9224/9224] [root@ip-172-31-41-7ec2-user]# ll total20 -rw-r—r—.1root root9224Sep12 2016mysql57-community-release-el7-9.noarch.rpm -rw-r—r—.1root root6140Nov12 2015mysql-community-release-el7-5.noarch.rpm |
---|
Install Binareis of MySQL 5.7 (RPM)
[root@ip-172-31-41-7ec2-user]# yum localinstall mysql57-community-release-el7-9.noarch.rpm —allowerasing Last metadata expiration check:0:23:49ago on Mon28Dec202008:18:00AM UTC. Dependencies resolved. ============================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================== Installing: mysql57-community-release noarch el7-9 @commandline 9.0k Removing dependent packages: mysql-community-release noarch el7-5 @System 4.3k Transaction Summary ============================================================================================================================================================================================================== Install 1Package Remove 1Package Total size:9.0k Isthisok[y/N]:y Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing :mysql57-community-release-el7-9.noarch 1/2 Erasing :mysql-community-release-el7-5.noarch 2/2 Verifying :mysql57-community-release-el7-9.noarch 1/2 Verifying :mysql-community-release-el7-5.noarch 2/2 Installed: mysql57-community-release-el7-9.noarch Complete! |
---|
Install MySQL 5.7
[root@ip-172-31-41-7ec2-user]# yum -y install mysql-community-server MySQL5.7Community Server 9.5MB/s|2.0MB 00:00 Last metadata expiration check:0:00:01ago on Mon28Dec202008:42:27AM UTC. Dependencies resolved. ============================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================== Installing: mysql-community-server x86_64 5.7.32-1.el7 mysql57-community 173M Installing dependencies: libaio x86_64 0.3.112-1.el8 rhel-8-baseos-rhui-rpms 33k mysql-community-client x86_64 5.7.32-1.el7 mysql57-community 25M mysql-community-common x86_64 5.7.32-1.el7 mysql57-community 308k mysql-community-libs x86_64 5.7.32-1.el7 mysql57-community 2.3M ncurses-compat-libs x86_64 6.1-7.20180224.el8 rhel-8-baseos-rhui-rpms 331k perl-Carp noarch 1.42-396.el8 rhel-8-baseos-rhui-rpms 30k perl-Data-Dumper x86_64 2.167-399.el8 rhel-8-baseos-rhui-rpms 58k perl-Digest noarch 1.17-395.el8 rhel-8-appstream-rhui-rpms 27k perl-Digest-MD5 x86_64 2.55-396.el8 rhel-8-appstream-rhui-rpms 37k perl-Encode x86_64 4:2.97-3.el8 rhel-8-baseos-rhui-rpms 1.5M perl-Errno x86_64 1.28-416.el8 rhel-8-baseos-rhui-rpms 76k perl-Exporter noarch 5.72-396.el8 rhel-8-baseos-rhui-rpms 34k perl-File-Path noarch 2.15-2.el8 rhel-8-baseos-rhui-rpms 38k perl-File-Temp noarch 0.230.600-1.el8 rhel-8-baseos-rhui-rpms 63k perl-Getopt-Long noarch 1:2.50-4.el8 rhel-8-baseos-rhui-rpms 63k perl-HTTP-Tiny noarch 0.074-1.el8 rhel-8-baseos-rhui-rpms 58k Transaction Summary ============================================================================================================================================================================================================== Install 47Packages Total download size:214M Installed size:912M Downloading Packages: (1/47):mysql-community-common-5.7.32-1.el7.x86_64.rpm 2.7MB/s|308kB 00:00 (2/47):mysql-community-libs-5.7.32-1.el7.x86_64.rpm 11MB/s|2.3MB 00:00 (3/47):perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch.rpm 136kB/s| 15kB 00:00 (4/47):perl-URI-1.73-3.el8.noarch.rpm 1.0MB/s|116kB 00:00 (5/47):perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64.rpm 3.1MB/s|379kB 00:00 (6/47):perl-Digest-1.17-395.el8.noarch.rpm 277kB/s| 27kB 00:00 (7/47):mysql-community-client-5.7.32-1.el7.x86_64.rpm 35MB/s| 25MB 00:00 (8/47):perl-Digest-MD5-2.55-396.el8.x86_64.rpm 245kB/s| 37kB 00:00 ——————————————————————————————————————————————————————————————————————————————————————————————————————— Total 68MB/s|214MB 00:03 warning:/var/cache/dnf/mysql57-community-65b9ecb4cc6a2553/packages/mysql-community-client-5.7.32-1.el7.x86_64.rpm:Header V3 DSA/SHA1 Signature,key ID5072e1f5:NOKEY MySQL5.7Community Server 5.7MB/s|5.8kB 00:00 Importing GPG key0x5072E1F5: Userid :”MySQL Release Engineering mysql-build@oss.oracle.com“ Fingerprint:A4A9406876FCBD3C456770C88C718D3B5072E1F5 From :/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing :perl-libs-4:5.26.3-416.el8.x86_64 1/47 Installing :perl-Exporter-5.72-396.el8.noarch 2/47 Installing :perl-Carp-1.42-396.el8.noarch 3/47 Installing :perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 4/47 Installing :perl-parent-1:0.237-1.el8.noarch 5/47 Installing :perl-Text-ParseWords-3.30-395.el8.noarch 6/47 Installing :mysql-community-common-5.7.32-1.el7.x86_64 7/47 Installing :mysql-community-libs-5.7.32-1.el7.x86_64 8/47 Running scriptlet:mysql-community-libs-5.7.32-1.el7.x86_64 8/47 Verifying :mysql-community-client-5.7.32-1.el7.x86_64 1/47 Verifying :mysql-community-common-5.7.32-1.el7.x86_64 2/47 Verifying :mysql-community-libs-5.7.32-1.el7.x86_64 3/47 Verifying :mysql-community-server-5.7.32-1.el7.x86_64 4/47 Verifying :perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch 5/47 Verifying :perl-URI-1.73-3.el8.noarch 6/47 Verifying :perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64 7/47 Verifying :perl-Digest-1.17-395.el8.noarch 8/47 Installed: libaio-0.3.112-1.el8.x86_64 mysql-community-client-5.7.32-1.el7.x86_64 mysql-community-common-5.7.32-1.el7.x86_64 mysql-community-libs-5.7.32-1.el7.x86_64 mysql-community-server-5.7.32-1.el7.x86_64 ncurses-compat-libs-6.1-7.20180224.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-Data-Dumper-2.167-399.el8.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch perl-MIME-Base64-3.15-396.el8.x86_64 perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64 perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-3.el8.x86_64 perl-Storable-1:3.11-3.el8.x86_64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-URI-1.73-3.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libnet-3.11-3.el8.noarch perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 Complete! |
---|
Check Version of MySQL
1 2 |
[root@ip-172-31-41-7ec2-user]# mysql -V mysql Ver14.14Distrib5.7.32,forLinux(x86_64)using EditLine wrapper |
---|---|
Start the Service of MySQL
1 2 |
[root@ip-172-31-41-7ec2-user]# service mysqld start Redirecting to/bin/systemctl start mysqld.service |
---|---|
Check the Status of MySQL
[root@ip-172-31-40-179ec2-user]# service mysqld status Redirecting to/bin/systemctl status mysqld.service ●mysqld.service-MySQL Server Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendor preset:disabled) Active:active(running)since Tue2020-12-2912:03:34UTC;21sago Docs:man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process:66842ExecStart=/usr/sbin/mysqld—daemonize—pid-file=/var/run/mysqld/mysqld.pid$MYSQLD_OPTS(code=exited,status=0/SUCCESS) Process:66783ExecStartPre=/usr/bin/mysqld_pre_systemd(code=exited,status=0/SUCCESS) Main PID:66845(mysqld) Tasks:27(limit:4836) Memory:233.8M CGroup:/system.slice/mysqld.service └─66845/usr/sbin/mysqld—daemonize—pid-file=/var/run/mysqld/mysqld.pid Dec2912:03:29ip-172-31-40-179.ap-south-1.compute.internalsystemd[1]:Starting MySQL Server… Dec2912:03:34ip-172-31-40-179.ap-south-1.compute.internalsystemd[1]:Started MySQL Server. |
---|
Connect to MySQL 5.7 Database
[root@ip-172-31-41-7ec2-user]# mysql -u root -p Enter password: Welcome tothe MySQL monitor. Commands endwith;or\g. Your MySQL connection id is3 Server version:5.7.32MySQL Community Server(GPL) Copyright(c)2000,2020,Oracle and/orits affiliates.All rights reserved. Oracle isaregistered trademark of Oracle Corporation and/orits affiliates.Other names may be trademarks of their respective owners. Type’help;’or’\h’forhelp.Type’\c’toclear the current input statement. mysql> |
---|
Check the version of MySQL 5.7 Database
mysql>select@@version; +—————-+ |@@version| +—————-+ |5.7.32 | +—————-+ 1row inset(0.00sec) mysql>exit ByE |
---|
Upgrading the MySQL 5.7 Database
[root@ip-172-31-41-7ec2-user]# mysql_upgrade -u root -p Enter password: Checking ifupdate isneeded. Checking server version. Running queries toupgrade MySQL server. Checking system database. mysql.columns_priv OK mysql.db OK mysql.engine_cost OK mysql.event OK mysql.func OK mysql.general_log OK mysql.gtid_executed OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK mysql.help_topic OK mysql.innodb_index_stats OK mysql.innodb_table_stats OK mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.server_cost OK mysql.servers OK mysql.slave_master_info OK mysql.slave_relay_log_info OK mysql.slave_worker_info OK mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK Upgrading the sys schema. Checking databases. sys.sys_config OK Upgrade process completed successfully. Checking ifupdate isneeded. |
---|
Setting the root Password
This command enables you to improve the security of your MySQL installation in the following ways: You can set a password for root accounts.
You can remove root accounts that are accessible from outside the local host.
You can remove anonymous-user accounts.
You can remove the test database, which by default can be accessed by anonymous users.
[root@ip-172-31-41-7ec2-user]# mysql_secure_installation Securing the MySQL server deployment. Enter password foruser root: VALIDATE PASSWORD PLUGIN can be used totest passwords andimprove security.It checks the strength of password andallows the users toset only those passwords which are secure enough.Would you like tosetup VALIDATE PASSWORD plugin? Pressy|YforYes,any other key forNo: Using existing password forroot. Change the password forroot?((Pressy|YforYes,any other key forNo): …skipping. By default,aMySQL installation has an anonymous user, allowing anyone tolog into MySQL without having tohave auser account created forthem.Thisisintended only for testing,andtomake the installation goabit smoother. You should remove them before moving intoaproduction environment. Remove anonymous users?(Pressy|YforYes,any other key forNo):y Success. Normally,root should only be allowed toconnect from ‘localhost’.Thisensures that someone cannot guess at the root password from the network. Disallow root login remotely?(Pressy|YforYes,any other key forNo):y Success. By default,MySQL comes withadatabase named’test’that anyone can access.Thisisalso intended only fortesting, andshould be removed before moving intoaproduction environment. Remove test database andaccess toit?(Pressy|YforYes,any other key forNo):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?(Pressy|YforYes,any other key forNo):y Success. |
---|
Connect to MySQL 5.7 Database
[root@ip-172-31-41-7ec2-user]# mysql -u root -p Enter password: Welcome tothe MySQL monitor. Commands endwith;or\g. Your MySQL connection id is3 Server version:5.7.32MySQL Community Server(GPL) Copyright(c)2000,2020,Oracle and/orits affiliates.All rights reserved. Oracle isaregistered trademark of Oracle Corporation and/orits affiliates.Other names may be trademarks of their respective owners. Type’help;’or’\h’forhelp.Type’\c’toclear the current input statement. mysql> |
---|
Check the version of MySQL 5.7 Database
mysql>select@@version; +—————-+ |@@version| +—————-+ |5.7.32 | +—————-+ 1row inset(0.00sec) mysql>exit Bye |
---|
8. Upgrade MySQL from 5.7 to 8.0
Check the Status of MySQL
[root@ip-172-31-41-7ec2-user]# service mysqld start Redirecting to/bin/systemctl start mysqld.service [root@ip-172-31-41-7ec2-user]# service mysqld status Redirecting to/bin/systemctl status mysqld.service ●mysqld.service-MySQL Community Server Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendor preset:disabled) Active:active(running)since Mon2020-12-2808:22:56UTC;4sago Process:58906ExecStartPost=/usr/bin/mysql-systemd-start post(code=exited,status=0/SUCCESS) Process:58846ExecStartPre=/usr/bin/mysql-systemd-start pre(code=exited,status=0/SUCCESS) Main PID:58905(mysqld_safe) Tasks:23(limit:4836) Memory:493.3M CGroup:/system.slice/mysqld.service ├─58905/bin/sh/usr/bin/mysqld_safe—basedir=/usr └─59080/usr/sbin/mysqld—basedir=/usr—datadir=/var/lib/mysql—plugin-dir=/usr/lib64/mysql/plugin—log-error=/var/log/mysqld.log—pid-file=/var/run/mysqld/mysqld.pid—socket=/var/lib/mysq> |
---|
Install MySQL Shell
[root@ip-172-31-41-7ec2-user]# yum install mysql-shell Last metadata expiration check:0:13:48ago on Mon28Dec202005:11:59PM UTC. Dependencies resolved. ===================================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================================== Installing: mysql-shell x86_64 8.0.22-1.el7 mysql-tools-community 29M Installing dependencies: compat-openssl10 x86_64 1:1.0.2o-3.el8 rhel-8-appstream-rhui-rpms 1.1M make x86_64 1:4.2.1-10.el8 rhel-8-baseos-rhui-rpms 498k Transaction Summary ===================================================================================================================================================================== Install 3Packages Total download size:31M Installed size:133M Isthisok[y/N]:y Downloading Packages: (1/3):make-4.2.1-10.el8.x86_64.rpm 3.4MB/s|498kB 00:00 (2/3):compat-openssl10-1.0.2o-3.el8.x86_64.rpm 7.6MB/s|1.1MB 00:00 (3/3):mysql-shell-8.0.22-1.el7.x86_64.rpm 76MB/s| 29MB 00:00 ——————————————————————————————————————————————————————————————————————————————————- Total 64MB/s| 31MB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing :make-1:4.2.1-10.el8.x86_64 1/3 Running scriptlet:make-1:4.2.1-10.el8.x86_64 1/3 Installing :compat-openssl10-1:1.0.2o-3.el8.x86_64 2/3 Running scriptlet:compat-openssl10-1:1.0.2o-3.el8.x86_64 2/3 Installing :mysql-shell-8.0.22-1.el7.x86_64 3/3 Running scriptlet:mysql-shell-8.0.22-1.el7.x86_64 3/3 Verifying :mysql-shell-8.0.22-1.el7.x86_64 1/3 Verifying :compat-openssl10-1:1.0.2o-3.el8.x86_64 2/3 Verifying :make-1:4.2.1-10.el8.x86_64 3/3 Installed: compat-openssl10-1:1.0.2o-3.el8.x86_64 make-1:4.2.1-10.el8.x86_64 mysql-shell-8.0.22-1.el7.x86_64 Complete! |
---|
Check the migration issues of Database data
Note : please resolve the issues before the upgrade
when you do upgrading the software binaries but not touch the data
[root@ip-172-31-41-7ec2-user]# mysqlsh — util checkForServerUpgrade root@localhost:3306 —target-version=8.0.21 —output-format=text —config-path=/etc/my.cnf Please provide the password for’root@localhost:3306’:* Save password for’root@localhost:3306’?[Y]es/[N]o/Ne[v]er(defaultNo):Y The MySQL server at localhost:3306,version5.7.32-MySQL Community Server (GPL),will now be checked forcompatibility issues forupgrade toMySQL 8.0.21… 1)Usage of old temporal type No issues found 2)Usage of db objects with names conflicting with newreserved keywords No issues found 3)Usage of utf8mb3 charset No issues found 4)Table names inthe mysql schema conflicting with newtables in8.0 No issues found 5)Partitioned tables using engines with non nativepartitioning No issues found 6)Foreign key constraint names longer than64characters No issues found 7)Usage of obsolete MAXDB sql_mode flag No issues found 8)Usage of obsolete sql_mode flags Notice:The following DB objects have obsolete options persisted for sql_mode,which will be cleared during upgrade to8.0. More information: https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html#mysql-nutshell-removals globalsystem variable sql_mode-defined using obsolete NO_AUTO_CREATE_USER option 9)ENUM/SET column definitions containing elements longer than255characters No issues found 10)Usage of partitioned tables inshared tablespaces No issues found 11)Circular directory references intablespace data file paths No issues found 12)Usage of removed functions No issues found 13)Usage of removed GROUP BY ASC/DESC syntax No issues found 14)Removed system variables forerror logging tothe system log configuration No issues found 15)Removed system variables No issues found 16)System variables with newdefaultvalues Warning:Following system variables that are notdefined inyour configuration file will have newdefaultvalues.Please review ifyou rely on their current values andifso define them before performing upgrade. More information: https://mysqlserverteam.com/new-defaults-in-mysql-8-0/ back_log-defaultvalue will change character_set_server-defaultvalue will change from latin1 toutf8mb4 collation_server-defaultvalue will change from latin1_swedish_ci to utf8mb4_0900_ai_ci event_scheduler-defaultvalue will change from OFF toON explicit_defaults_for_timestamp-defaultvalue will change from OFF toON innodb_autoinc_lock_mode-defaultvalue will change from1(consecutive)to 2(interleaved) innodb_flush_method-defaultvalue will change from NULLtofsync(Unix), unbuffered(Windows) innodb_flush_neighbors-defaultvalue will change from1(enable)to0 (disable) innodb_max_dirty_pages_pct-defaultvalue will change from75(%) 90(%) innodb_max_dirty_pages_pct_lwm-defaultvalue will change from_0(%)to10 (%) innodb_undo_log_truncate-defaultvalue will change from OFF toON innodb_undo_tablespaces-defaultvalue will change from0to2 log_bin-defaultvalue will change from OFF toON log_error_verbosity-defaultvalue will change from3(Notes)to2(Warning) log_slave_updates-defaultvalue will change from OFF toON master_info_repository-defaultvalue will change from FILE toTABLE max_allowed_packet-defaultvalue will change from4194304(4MB)to67108864 (64MB) max_error_count-defaultvalue will change from64to1024 optimizer_trace_max_mem_size-defaultvalue will change from16KBto1MB performance_schema_consumer_events_transactions_current-defaultvalue will change from OFF toON performance_schema_consumer_events_transactions_history-defaultvalue will change from OFF toON relay_log_info_repository-defaultvalue will change from FILE toTABLE server_id-defaultvalue will change from0to1 slave_rows_search_algorithms-defaultvalue will change from’INDEX_SCAN, TABLE_SCAN’to’INDEX_SCAN, HASH_SCAN’ table_open_cache-defaultvalue will change from2000to4000 transaction_write_set_extraction-defaultvalue will change from OFF to XXHASH64 17)Zero Date,Datetime,andTimestamp values No issues found 18)Schema inconsistencies resulting from file removal orcorruption No issues found 19)Tables recognized by InnoDB that belong toadifferent engine No issues found 20)Issues reported by’check table x for upgrade’command No issues found 21)Newdefaultauthentication plugin considerations Warning:The newdefaultauthentication plugin’caching_sha2_password’offers more secure password hashing than previously used’mysql_native_password’ (andconsequent improved client connection authentication).However,it also has compatibility implications that may affect existing MySQL installations. Ifyour MySQL installation must serve pre-8.0clients andyou encounter compatibility issues after upgrading,the simplest way toaddress those issues istoreconfigure the server torevert tothe previous default authentication plugin(mysql_native_password).Forexample,usethese lines inthe server option file: [mysqld] default_authentication_plugin=mysql_native_password However,the setting should be viewed astemporary,notasalongterm or permanent solution,because it causes newaccounts created with the setting ineffect toforego the improved authentication security. Ifyou are using replication please take time tounderstand how the authentication plugin changes may impact you. More information: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password-compatibility-issues https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password-replication Errors: 0 Warnings:27 Notices: 1 No fatal errors were found that would prevent an upgrade,but some potential issues were detected.Please ensure that the reported issues are notsignificant before upgrading. |
---|
Stop the Service of MySQL 5.6
[root@ip-172-31-41-7ec2-user]# service mysqld stop Redirecting to/bin/systemctl stop mysqld.service |
---|
Check the Status of MySQL
[root@ip-172-31-41-7ec2-user]## service mysqld status Redirecting to/bin/systemctl status mysqld.service ●mysqld.service-MySQL Server Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendor preset:disabled) Active:inactive(dead)since Mon2020-12-2817:33:55UTC;3sago Docs:man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process:62363ExecStart=/usr/sbin/mysqld—daemonize—pid-file=/var/run/mysqld/mysqld.pid$MYSQLD_OPTS(code=exited,status=0/SUCCESS) Process:62346ExecStartPre=/usr/bin/mysqld_pre_systemd(code=exited,status=0/SUCCESS) Main PID:62366(code=exited,status=0/SUCCESS) Dec2817:28:26ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:Starting MySQL Server… Dec2817:28:26ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:Started MySQL Server. Dec2817:33:54ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:Stopping MySQL Server… Dec2817:33:55ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:mysqld.service:Succeeded. Dec2817:33:55ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:Stopped MySQL Server. |
---|
Remove Binaries of MySQL 5.7
[root@ip-172-31-41-7ec2-user]# yum remove mysql-community* No match forargument:mysql-community-release-el7-5.noarch.rpm No packages marked forremoval. Dependencies resolved. Nothing todo. Complete! [root@ip-172-31-36-253ec2-user]# yum remove mysql-community-server* Dependencies resolved. ===================================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================================== Removing: mysql-community-server x86_64 5.7.32-1.el7 @mysql57-community 762M Removing unused dependencies: libaio x86_64 0.3.112-1.el8 @rhel-8-baseos-rhui-rpms 93k mysql-community-client x86_64 5.7.32-1.el7 @mysql57-community 101M mysql-community-common x86_64 5.7.32-1.el7 @mysql57-community 2.8M mysql-community-libs x86_64 5.7.32-1.el7 @mysql57-community 9.4M ncurses-compat-libs x86_64 6.1-7.20180224.el8 @rhel-8-baseos-rhui-rpms 1.2M perl-Carp noarch 1.42-396.el8 @rhel-8-baseos-rhui-rpms 41k perl-Data-Dumper x86_64 2.167-399.el8 @rhel-8-baseos-rhui-rpms 104k perl-Digest noarch 1.17-395.el8 @rhel-8-appstream-rhui-rpms 26k perl-Digest-MD5 x86_64 2.55-396.el8 @rhel-8-appstream-rhui-rpms 55k perl-Encode x86_64 4:2.97-3.el8 @rhel-8-baseos-rhui-rpms 9.7M perl-Errno x86_64 1.28-416.el8 @rhel-8-baseos-rhui-rpms 9.3k perl-Exporter noarch 5.72-396.el8 @rhel-8-baseos-rhui-rpms 54k Transaction Summary ===================================================================================================================================================================== Remove 47Packages Freed space:912M Isthisok[y/N]:y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet:mysql-community-server-5.7.32-1.el7.x86_64 1/1 Running scriptlet:mysql-community-server-5.7.32-1.el7.x86_64 1/47 Erasing :mysql-community-server-5.7.32-1.el7.x86_64 1/47 Running scriptlet:mysql-community-server-5.7.32-1.el7.x86_64 1/47 Erasing :perl-libnet-3.11-3.el8.noarch 2/47 Erasing :perl-URI-1.73-3.el8.noarch 3/47 Erasing :perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch 4/47 Erasing :perl-HTTP-Tiny-0.074-1.el8.noarch 5/47 Erasing :perl-Encode-4:2.97-3.el8.x86_64 6/47 Erasing :perl-Pod-Simple-1:3.35-395.el8.noarch 7/47 Erasing :perl-podlators-4.11-1.el8.noarch 8/47 Verifying :libaio-0.3.112-1.el8.x86_64 1/47 Verifying :mysql-community-client-5.7.32-1.el7.x86_64 2/47 Verifying :mysql-community-common-5.7.32-1.el7.x86_64 3/47 Verifying :mysql-community-libs-5.7.32-1.el7.x86_64 4/47 Verifying :mysql-community-server-5.7.32-1.el7.x86_64 5/47 Verifying :ncurses-compat-libs-6.1-7.20180224.el8.x86_64 6/47 Verifying :perl-Carp-1.42-396.el8.noarch 7/47 Verifying :perl-Data-Dumper-2.167-399.el8.x86_64 8/47 Removed: libaio-0.3.112-1.el8.x86_64 mysql-community-client-5.7.32-1.el7.x86_64 mysql-community-common-5.7.32-1.el7.x86_64 mysql-community-libs-5.7.32-1.el7.x86_64 mysql-community-server-5.7.32-1.el7.x86_64 ncurses-compat-libs-6.1-7.20180224.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-Data-Dumper-2.167-399.el8.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch perl-MIME-Base64-3.15-396.el8.x86_64 perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64 perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-3.el8.x86_64 perl-Storable-1:3.11-3.el8.x86_64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-URI-1.73-3.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libnet-3.11-3.el8.noarch perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 Complete! |
---|
Download Binaries of MySQL 8.0 (RPM)
[root@ip-172-31-41-7ec2-user]# wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm —2021-01-0111:12:44— https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm Resolving repo.mysql.com(repo.mysql.com)…104.120.171.24 Connecting torepo.mysql.com(repo.mysql.com)|104.120.171.24|:443…connected. HTTP request sent,awaiting response…200OK Length:26024(25K)[application/x-redhat-package-manager] Saving to:‘mysql80-community-release-el7-3.noarch.rpm’ mysql80-community-release-el7-3.noarch.rpm 100%[=================================================================================================================>] 25.41K —.-KB/s in0.02s 2021-01-0111:12:44(1.26MB/s)-‘mysql80-community-release-el7-3.noarch.rpm’saved[26024/26024] [root@ip-172-31-12-117ec2-user]# ll total40 -rw-r—r—.1root root 9224Sep12 2016mysql57-community-release-el7-9.noarch.rpm -rw-r—r—.1root root26024Apr24 2019mysql80-community-release-el7-3.noarch.rpm |
---|
Install Binareis of MySQL 8.0 (RPM)
[root@ip-172-31-41-7ec2-user]# yum localinstall mysql80-community-release-el7-3.noarch.rpm —allowerasing Last metadata expiration check:0:27:46ago on Mon28Dec202005:11:59PM UTC. Dependencies resolved. ===================================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================================== Installing: mysql80-community-release noarch el7-3 @commandline 25k Removing dependent packages: mysql57-community-release noarch el7-9 @@commandline 8.6k Transaction Summary ===================================================================================================================================================================== Install 1Package Remove 1Package Total size:25k Isthisok[y/N]:y Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing :mysql80-community-release-el7-3.noarch 1/2 Erasing :mysql57-community-release-el7-9.noarch 2/2 Verifying :mysql80-community-release-el7-3.noarch 1/2 Verifying :mysql57-community-release-el7-9.noarch 2/2 Installed: mysql80-community-release-el7-3.noarch Removed: mysql57-community-release-el7-9.noarch Complete! |
---|
Install MySQL 8.0
[root@ip-172-31-41-7ec2-user]# yum install mysql-community-server* MySQL8.0Community Server 17MB/s|1.5MB 00:00 Dependencies resolved. ===================================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================================== Installing: mysql-community-server x86_64 8.0.22-1.el7 mysql80-community 510M Installing dependencies: libaio x86_64 0.3.112-1.el8 rhel-8-baseos-rhui-rpms 33k mysql-community-client x86_64 8.0.22-1.el7 mysql80-community 48M mysql-community-client-plugins x86_64 8.0.22-1.el7 mysql80-community 235k mysql-community-common x86_64 8.0.22-1.el7 mysql80-community 616k mysql-community-libs x86_64 8.0.22-1.el7 mysql80-community 4.6M ncurses-compat-libs x86_64 6.1-7.20180224.el8 rhel-8-baseos-rhui-rpms 331k perl-Carp noarch 1.42-396.el8 rhel-8-baseos-rhui-rpms 30k perl-Data-Dumper x86_64 2.167-399.el8 rhel-8-baseos-rhui-rpms 58k perl-Digest noarch 1.17-395.el8 rhel-8-appstream-rhui-rpms 27k perl-Digest-MD5 x86_64 2.55-396.el8 rhel-8-appstream-rhui-rpms 37k perl-Encode x86_64 4:2.97-3.el8 rhel-8-baseos-rhui-rpms 1.5M perl-Errno x86_64 1.28-416.el8 rhel-8-baseos-rhui-rpms 76k Transaction Summary ===================================================================================================================================================================== Install 48Packages Total download size:575M Installed size:2.6G Isthisok[y/N]:y Downloading Packages: (1/48):mysql-community-common-8.0.22-1.el7.x86_64.rpm 11MB/s|616kB 00:00 (2/48):mysql-community-libs-8.0.22-1.el7.x86_64.rpm 45MB/s|4.6MB 00:00 (3/48):mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm 507kB/s|235kB 00:00 (4/48):perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch.rpm 136kB/s| 15kB 00:00 (5/48):perl-URI-1.73-3.el8.noarch.rpm 955kB/s|116kB 00:00 (6/48):mysql-community-client-8.0.22-1.el7.x86_64.rpm 54MB/s| 48MB 00:00 (7/48):perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64.rpm 1.9MB/s|379kB 00:00 (8/48):perl-Digest-1.17-395.el8.noarch.rpm 270kB/s| 27kB 00:00 ——————————————————————————————————————————————————————————————————————————————————- Total 41MB/s|575MB 00:13 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing :perl-libs-4:5.26.3-416.el8.x86_64 1/48 Installing :perl-Exporter-5.72-396.el8.noarch 2/48 Installing :perl-Carp-1.42-396.el8.noarch 3/48 Installing :perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 4/48 Installing :perl-parent-1:0.237-1.el8.noarch 5/48 Installing :perl-Text-ParseWords-3.30-395.el8.noarch 6/48 Installing :mysql-community-common-8.0.22-1.el7.x86_64 7/48 Installing :mysql-community-client-plugins-8.0.22-1.el7.x86_64 8/48 Verifying :mysql-community-client-8.0.22-1.el7.x86_64 1/48 Verifying :mysql-community-client-plugins-8.0.22-1.el7.x86_64 2/48 Verifying :mysql-community-common-8.0.22-1.el7.x86_64 3/48 Verifying :mysql-community-libs-8.0.22-1.el7.x86_64 4/48 Verifying :mysql-community-server-8.0.22-1.el7.x86_64 5/48 Verifying :perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch 6/48 Verifying :perl-URI-1.73-3.el8.noarch 7/48 Verifying :perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64 8/48 Installed: libaio-0.3.112-1.el8.x86_64 mysql-community-client-8.0.22-1.el7.x86_64 mysql-community-client-plugins-8.0.22-1.el7.x86_64 mysql-community-common-8.0.22-1.el7.x86_64 mysql-community-libs-8.0.22-1.el7.x86_64 mysql-community-server-8.0.22-1.el7.x86_64 ncurses-compat-libs-6.1-7.20180224.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-Data-Dumper-2.167-399.el8.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch perl-MIME-Base64-3.15-396.el8.x86_64 perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch perl-Net-SSLeay-1.88-1.module+el8.3.0+6446+594cad75.x86_64 perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 Complete! |
---|
Check Version of MySQL
[root@ip-172-31-41-7ec2-user]# mysql -V mysql Ver8.0.22forLinux on x86_64(MySQL Community Server-GPL) |
---|
Start the Service of MySQL
[root@ip-172-31-41-7ec2-user]# service mysqld start Redirecting to/bin/systemctl start mysqld.service |
---|
Check the Status of MySQL
[root@ip-172-31-41-7ec2-user]# service mysqld status Redirecting to/bin/systemctl status mysqld.service ●mysqld.service-MySQL Server Loaded:loaded(/usr/lib/systemd/system/mysqld.service;enabled;vendor preset:disabled) Active:active(running)since Mon2020-12-2817:46:33UTC;16sago Docs:man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process:65171ExecStartPre=/usr/bin/mysqld_pre_systemd(code=exited,status=0/SUCCESS) Main PID:65196(mysqld) Status:”Server is operational” Tasks:38(limit:4836) Memory:523.5M CGroup:/system.slice/mysqld.service └─65196/usr/sbin/mysqld Dec2817:46:23ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:Starting MySQL Server… Dec2817:46:33ip-172-31-36-253.ap-south-1.compute.internalsystemd[1]:Started MySQL Server. |
---|
Connect to MySQL 8.0 Database
[root@ip-172-31-41-7ec2-user]# mysql -u root -p Enter password: Welcome tothe MySQL monitor. Commands endwith;or\g. Your MySQL connection id is11 Server version:8.0.22MySQL Community Server-GPL Copyright(c)2000,2020,Oracle and/orits affiliates.All rights reserved. Oracle isaregistered trademark of Oracle Corporation and/orits affiliates.Other names may be trademarks of their respective owners. Type’help;’or’\h’forhelp.Type’\c’toclear the current input statement. mysql> |
---|
Check the version of MySQL 8.0 Database
mysql>select@@version; +—————-+ |@@version| +—————-+ |8.0.22 | +—————-+ 1row inset(0.00sec) mysql>exit Bye |
---|
Setting the root Password
This command enables you to improve the security of your MySQL installation in the following ways: You can set a password for root accounts.
You can remove root accounts that are accessible from outside the local host.
You can remove anonymous-user accounts.
You can remove the test database, which by default can be accessed by anonymous users.
[root@ip-172-31-41-7ec2-user]# mysql_secure_installation Securing the MySQL server deployment. Enter password foruser root: VALIDATE PASSWORD PLUGIN can be used totest passwords andimprove security.It checks the strength of password andallows the users toset only those passwords which are secure enough.Would you like tosetup VALIDATE PASSWORD plugin? Pressy|YforYes,any other key forNo: Using existing password forroot. Change the password forroot?((Pressy|YforYes,any other key forNo): …skipping. By default,aMySQL installation has an anonymous user, allowing anyone tolog into MySQL without having tohave auser account created forthem.Thisisintended only for testing,andtomake the installation goabit smoother. You should remove them before moving intoaproduction environment. Remove anonymous users?(Pressy|YforYes,any other key forNo):y Success. Normally,root should only be allowed toconnect from ‘localhost’.Thisensures that someone cannot guess at the root password from the network. Disallow root login remotely?(Pressy|YforYes,any other key forNo):y Success. By default,MySQL comes withadatabase named’test’that anyone can access.Thisisalso intended only fortesting, andshould be removed before moving intoaproduction environment. Remove test database andaccess toit?(Pressy|YforYes,any other key forNo):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?(Pressy|YforYes,any other key forNo):y Success. |
---|
Connect to MySQL 8.0 Database
[root@ip-172-31-41-7ec2-user]# mysql -u root -p Enter password: Welcome tothe MySQL monitor. Commands endwith;or\g. Your MySQL connection id is11 Server version:8.0.22MySQL Community Server-GPL Copyright(c)2000,2020,Oracle and/orits affiliates.All rights reserved. Oracle isaregistered trademark of Oracle Corporation and/orits affiliates.Other names may be trademarks of their respective owners. Type’help;’or’\h’forhelp.Type’\c’toclear the current input statement. mysql> |
---|
Check the version of MySQL 8.0 Database
mysql>select@@version; +—————-+ |@@version| +—————-+ |8.0.22 | +—————-+ 1row inset(0.00sec) mysql>exit Bye |
---|
Thank you for giving your valuable time to read the above information. Pleaseclick here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.