Quick and easy RPM based MySQL installation on CentOS

There are several ways you can install MySQL, Most common and quick installation of MySQL is often RPM based so we created this post for anyone who is absolute beginner in MySQL and want to begin with quick / simple MySQL installation .

Step 1 – Download MySQL 5.7 RPM

[root@localhost MySQL57RPM]# wget https://dev.mysql.com/get/mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
--2018-03-14 12:55:56--  https://dev.mysql.com/get/mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
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://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar [following]
--2018-03-14 12:55:58--  https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
Resolving cdn.mysql.com (cdn.mysql.com)... 106.51.145.84
Connecting to cdn.mysql.com (cdn.mysql.com)|106.51.145.84|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 593940480 (566M) [application/x-tar]
Saving to: ‘mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar’

100%[=================================================================================================>] 593,940,480 17.6MB/s   in 39s    

2018-03-14 12:56:37 (14.6 MB/s) - ‘mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar’ saved [593940480/593940480]

[root@localhost MySQL57RPM]# ls
mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
[root@localhost MySQL57RPM]# 

[root@localhost MySQL57RPM]# ls *.rpm 
mysql-community-client-5.7.21-1.el7.x86_64.rpm           mysql-community-libs-5.7.21-1.el7.x86_64.rpm
mysql-community-common-5.7.21-1.el7.x86_64.rpm           mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
mysql-community-devel-5.7.21-1.el7.x86_64.rpm            mysql-community-minimal-debuginfo-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-5.7.21-1.el7.x86_64.rpm         mysql-community-server-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm  mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm   mysql-community-test-5.7.21-1.el7.x86_64.rpm
[root@localhost MySQL57RPM]#  


 

Step 2 – Install MySQL 5.7

[root@localhost MySQL57RPM]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm mysql-community-client-5.7.21-1.el7.x86_64.rpm  mysql-community-common-5.7.21-1.el7.x86_64.rpm mysql-community-devel-5.7.21-1.el7.x86_64.rpm mysql-community-libs-5.7.21-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm 
warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-5.7.21-1.e################################# [ 17%]
   2:mysql-community-libs-5.7.21-1.el7################################# [ 33%]
   3:mysql-community-client-5.7.21-1.e################################# [ 50%]
   4:mysql-community-server-5.7.21-1.e################################# [ 67%]
   5:mysql-community-devel-5.7.21-1.el################################# [ 83%]
   6:mysql-community-libs-compat-5.7.2################################# [100%]
[root@localhost MySQL57RPM]# 

 

Step 3 – Start MySQL and change the password

[root@localhost MySQL57RPM]# systemctl start mysqld 
[root@localhost MySQL57RPM]# 

[root@localhost MySQL57RPM]# grep 'temporary password' /var/log/mysqld.log 
2018-02-28T06:07:29.361311Z 1 [Note] A temporary password is generated for root@localhost: S3djwdAoj?Wn

[root@localhost MySQL57RPM]# mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21

Copyright (c) 2000, 2018, 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> set password for 'root'@'localhost'=password('Singapore/2018');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges ;
Query OK, 0 rows affected (0.00 sec)

 

Conclusion 

This post was made purely for anyone who want to install MySQL 5.7 on CentOS and play around, Enjoy playing around with MySQL 👍

 

About MinervaDB Corporation 88 Articles
Independent and vendor neutral consulting, support, remote DBA services and training for MySQL, MariaDB, Percona Server, PostgreSQL and ClickHouse with core expertize in performance, scalability and high availability . We are an virtual corporation, all of us work from home on multiple timezones and stay connected via Email, Skype, Google Hangouts, Phone and IRC supporting over 250 customers worldwide
UA-155183614-1