Database MySql 8 Installation using Yum Repository Method

December 23, 2020
()

Database MySql 8 Installation using Yum Repository Method


Database MySql can be installed using the below 3 different methods.

1) Yum InstallationThe easiest and fastest method to install MySql but provide no control over the installation.
2) RPM BundleNeed to download RPM Bundle and install MySql rpm manually.
3) Using BinariesManual method but give full control over the installation process. Click here to read more.

In this article, we are going to see MySQL 8 Installation using YUM Installation method. Here we are using OEL (Oracle Linux Server) 7.9.


Please note command wget and yum require internet access on server.

[root@test-machine01 yum.repos.d]# cat /etc/oracle-release
Oracle Linux Server release 7.9

[root@test-machine01 yum.repos.d]# uname -a
Linux test-machine01 4.14.35-2025.401.4.el7uek.x86_64 #2 SMP Thu Oct 8 12:12:36 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux


Download the MySQL YUM rpm package directly into the server using the below wget command. Once the command is complete we can see MySql YUM rpm is downloaded in the current directory.

[root@test-machine01 yum.repos.d]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
--2020-12-22 14:20:55--  https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm [following]
--2020-12-22 14:20:57--  https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 104.113.245.39
Connecting to repo.mysql.com (repo.mysql.com)|104.113.245.39|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26024 (25K) [application/x-redhat-package-manager]
Saving to: âmysql80-community-release-el7-3.noarch.rpmâ

100%[====================================================================================================================================================>] 26,024      --.-K/s   in 0.08s

2020-12-22 14:20:57 (330 KB/s) - âmysql80-community-release-el7-3.noarch.rpmâ saved [26024/26024]

[root@test-machine01 yum.repos.d]# ls -ltr
total 40
-rw-r--r--. 1 root root 26024 Apr 24  2019 mysql80-community-release-el7-3.noarch.rpm
-rw-r--r--. 1 root root   226 Oct  2 00:24 virt-ol7.repo
-rw-r--r--. 1 root root  2587 Oct  2 00:24 uek-ol7.repo
-rw-r--r--. 1 root root  4075 Oct  2 00:25 oracle-linux-ol7.repo


Install downloaded rpm using below rpm -ivh command, Once the command is completed It will create MySQL software repo files in /etc/yum.repos.d

[root@test-machine01 yum.repos.d]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
warning: mysql80-community-release-el7-3.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql80-community-release-el7-3  ################################# [100%]
[root@test-machine01 yum.repos.d]# ls -ltr
total 48
-rw-r--r--. 1 root root  2108 Apr 24  2019 mysql-community-source.repo
-rw-r--r--. 1 root root  2076 Apr 24  2019 mysql-community.repo
-rw-r--r--. 1 root root 26024 Apr 24  2019 mysql80-community-release-el7-3.noarch.rpm
-rw-r--r--. 1 root root   226 Oct  2 00:24 virt-ol7.repo
-rw-r--r--. 1 root root  2587 Oct  2 00:24 uek-ol7.repo
-rw-r--r--. 1 root root  4075 Oct  2 00:25 oracle-linux-ol7.repo


Install MySql 8 using the below yum command

[root@test-machine01 yum.repos.d]# yum install mysql mysql-server
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.22-1.el7 will be installed
--> Processing Dependency: mysql-community-client-plugins = 8.0.22-1.el7 for package: mysql-community-client-8.0.22-1.el7.x86_64
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.22-1.el7.x86_64
---> Package mysql-community-server.x86_64 0:8.0.22-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.22-1.el7 for package: mysql-community-server-8.0.22-1.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
---> Package mysql-community-client-plugins.x86_64 0:8.0.22-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:8.0.22-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:8.0.22-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:8.0.22-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================
 Package                                                    Arch                               Version                                    Repository                                     Size
==============================================================================================================================================================================================
Installing:
 mysql-community-client                                     x86_64                             8.0.22-1.el7                               mysql80-community                              48 M
 mysql-community-libs                                       x86_64                             8.0.22-1.el7                               mysql80-community                             4.6 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat                                x86_64                             8.0.22-1.el7                               mysql80-community                             1.2 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server                                     x86_64                             8.0.22-1.el7                               mysql80-community                             510 M
Installing for dependencies:
 mysql-community-client-plugins                             x86_64                             8.0.22-1.el7                               mysql80-community                             235 k
 mysql-community-common                                     x86_64                             8.0.22-1.el7                               mysql80-community                             616 k

Transaction Summary
==============================================================================================================================================================================================
Install  4 Packages (+2 Dependent packages)

Total download size: 564 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/mysql80-community/packages/mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYB  --:--:-- ETA
Public key for mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm is not installed
(1/6): mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm                                                                                                          | 235 kB  00:00:00
(2/6): mysql-community-common-8.0.22-1.el7.x86_64.rpm                                                                                                                  | 616 kB  00:00:00
(3/6): mysql-community-libs-8.0.22-1.el7.x86_64.rpm                                                                                                                    | 4.6 MB  00:00:03
(4/6): mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm                                                                                                             | 1.2 MB  00:00:00
(5/6): mysql-community-client-8.0.22-1.el7.x86_64.rpm                                                                                                                  |  48 MB  00:00:33
(6/6): mysql-community-server-8.0.22-1.el7.x86_64.rpm                                                                                                                  | 510 MB  00:02:55
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         3.1 MB/s | 564 MB  00:03:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <[email protected]>"
 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
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-8.0.22-1.el7.x86_64                                                                                                                                 1/7
  Installing : mysql-community-client-plugins-8.0.22-1.el7.x86_64                                                                                                                         2/7
  Installing : mysql-community-libs-8.0.22-1.el7.x86_64                                                                                                                                   3/7
  Installing : mysql-community-client-8.0.22-1.el7.x86_64                                                                                                                                 4/7
  Installing : mysql-community-server-8.0.22-1.el7.x86_64                                                                                                                                 5/7
  Installing : mysql-community-libs-compat-8.0.22-1.el7.x86_64                                                                                                                            6/7
  Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                         7/7
  Verifying  : mysql-community-libs-8.0.22-1.el7.x86_64                                                                                                                                   1/7
  Verifying  : mysql-community-server-8.0.22-1.el7.x86_64                                                                                                                                 2/7
  Verifying  : mysql-community-client-plugins-8.0.22-1.el7.x86_64                                                                                                                         3/7
  Verifying  : mysql-community-common-8.0.22-1.el7.x86_64                                                                                                                                 4/7
  Verifying  : mysql-community-client-8.0.22-1.el7.x86_64                                                                                                                                 5/7
  Verifying  : mysql-community-libs-compat-8.0.22-1.el7.x86_64                                                                                                                            6/7
  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                         7/7

Installed:
  mysql-community-client.x86_64 0:8.0.22-1.el7  mysql-community-libs.x86_64 0:8.0.22-1.el7  mysql-community-libs-compat.x86_64 0:8.0.22-1.el7  mysql-community-server.x86_64 0:8.0.22-1.el7

Dependency Installed:
  mysql-community-client-plugins.x86_64 0:8.0.22-1.el7                                              mysql-community-common.x86_64 0:8.0.22-1.el7

Replaced:
  mariadb-libs.x86_64 1:5.5.68-1.el7

Complete!


Once installation is completed all configurations will be ready like mysql user, mysqld service created already, You can find the default root user password (/!_fRiY+O6oj) in the file: /var/log/mysqld.log. Change root password from default to your own password.

[root@test-machine01 ~]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)

[root@test-machine01 ~]# systemctl list-unit-files |grep mysql
mysqld.service                                enabled
[email protected]                               disabled

[root@test-machine01 ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service

[root@test-machine01 ~]# ps -ef|grep mysql
mysql     62492      1 11 14:37 ?        00:00:00 /usr/sbin/mysqld
root      62544  62292  0 14:37 pts/0    00:00:00 grep --color=auto mysql

[root@test-machine01 log]# cat /var/log/mysqld.log |grep 'temporary password'
2020-12-22T11:37:32.115888Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: /!_fRiY+O6oj


[root@test-machine01 log]#  mysql -hlocalhost -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.22

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 'Root@1234';
Query OK, 0 rows affected (0.01 sec)

mysql> status
--------------
mysql  Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)

Connection id:          9
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         8.0.22 MySQL Community Server - GPL
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:            /var/lib/mysql/mysql.sock
Binary data as:         Hexadecimal
Uptime:                 23 hours 18 min 40 sec

Threads: 2  Questions: 10  Slow queries: 0  Opens: 134  Flush tables: 3  Open tables: 55  Queries per second avg: 0.000
--------------


Click here for Step by Step Database MySql 8 Installation using Binaries.


This document is only for learning purposes and always validate in the LAB environment first before applying in the LIVE environment.

Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to understand more about our pursuit.

Related Articles


Loading

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Hello and welcome to DBsGuru,I’m Jamsher Khan working as Senior Oracle DBA based in KSA-Jeddah, I have working experience in Oracle DBA, SQL Server, MySql, PostgreSQL, Linux, Golden Gate, ODA.Thanks for the visits!Share Learn Grow!

1 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *