Sriram Sanka – My Experiences with Databases & More

Oracle-MySQL-SQL SERVER-Python-Azure-AWS-Oracle Cloud-GCP etc

  • Enter your email address to follow this blog and receive notifications of new posts by email.

  • Total Views

    • 588,471 hits
  • $riram $anka


    The experiences, Test cases, views, and opinions etc expressed in this website are my own and does not reflect the views or opinions of my employer. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content.Product and company names mentioned in this website may be the trademarks of their respective owners.

Install MySQL 5.7 Community Server Using RPM Bundle- CENTOS 7

Posted by Sriram Sanka on October 2, 2022


To Install MySQL 5.7 we have To options.

  1. Add the Yum Repository and Install using Yum
  2. Download and Ship the Bundle/RPM and its dependencies to the Server and Install as RPM /Yum Local Install. i.e. either using yum Or rpm -ivh <RPM_NAME>

You can Download the RPM Or bundle Tar file from https://dev.mysql.com/downloads/repo/yum/

https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar – For 5.7

https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.30-1.el7.x86_64.rpm-bundle.tar for 8.0

Few Useful links to Download your desired Version.

https://dev.mysql.com/downloads/repo/yum/

https://downloads.mysql.com/archives/community/

wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar

Install the Downloaded Packages/RPM Using Local-Install Option.

yum localinstall mysql-community-{server,client,common,libs}-* mysql-5.*­
[root@localhost mysql_binaries]# yum localinstall mysql-community-{server,client,common,libs}-* mysql-5.*­
Loaded plugins: fastestmirror, langpacks
Examining mysql-community-server-5.7.9-1.el7.x86_64.rpm: mysql-community-server-5.7.9-1.el7.x86_64
Marking mysql-community-server-5.7.9-1.el7.x86_64.rpm to be installed
Examining mysql-community-client-5.7.9-1.el7.x86_64.rpm: mysql-community-client-5.7.9-1.el7.x86_64
Marking mysql-community-client-5.7.9-1.el7.x86_64.rpm to be installed
Examining mysql-community-common-5.7.9-1.el7.x86_64.rpm: mysql-community-common-5.7.9-1.el7.x86_64
Marking mysql-community-common-5.7.9-1.el7.x86_64.rpm to be installed
Examining mysql-community-libs-5.7.9-1.el7.x86_64.rpm: mysql-community-libs-5.7.9-1.el7.x86_64
Marking mysql-community-libs-5.7.9-1.el7.x86_64.rpm to be installed
Examining mysql-community-libs-compat-5.7.9-1.el7.x86_64.rpm: mysql-community-libs-compat-5.7.9-1.el7.x86_64
Marking mysql-community-libs-compat-5.7.9-1.el7.x86_64.rpm to be installed
Skipping: mysql-5.*­, filename does not end in .rpm.
Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
---> Package mysql-community-client.x86_64 0:5.7.9-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:5.7.9-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:5.7.9-1.el7 will be obsoleting
---> Package mysql-community-libs-compat.x86_64 0:5.7.9-1.el7 will be obsoleting
---> Package mysql-community-server.x86_64 0:5.7.9-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                      Arch                                    Version                                         Repository                                                                        Size
=============================================================================================================================================================================================================================================
Installing:
 mysql-community-client                                       x86_64                                  5.7.9-1.el7                                     /mysql-community-client-5.7.9-1.el7.x86_64                                       109 M
 mysql-community-common                                       x86_64                                  5.7.9-1.el7                                     /mysql-community-common-5.7.9-1.el7.x86_64                                       2.4 M
 mysql-community-libs                                         x86_64                                  5.7.9-1.el7                                     /mysql-community-libs-5.7.9-1.el7.x86_64                                         9.8 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat                                  x86_64                                  5.7.9-1.el7                                     /mysql-community-libs-compat-5.7.9-1.el7.x86_64                                  9.2 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server                                       x86_64                                  5.7.9-1.el7                                     /mysql-community-server-5.7.9-1.el7.x86_64                                       649 M

Transaction Summary
=============================================================================================================================================================================================================================================
Install  5 Packages

Total size: 779 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.9-1.el7.x86_64                                                                                                                                                                                 1/6
  Installing : mysql-community-libs-5.7.9-1.el7.x86_64                                                                                                                                                                                   2/6
  Installing : mysql-community-client-5.7.9-1.el7.x86_64                                                                                                                                                                                 3/6
  Installing : mysql-community-server-5.7.9-1.el7.x86_64                                                                                                                                                                                 4/6
  Installing : mysql-community-libs-compat-5.7.9-1.el7.x86_64                                                                                                                                                                            5/6
  Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                                                        6/6
  Verifying  : mysql-community-client-5.7.9-1.el7.x86_64                                                                                                                                                                                 1/6
  Verifying  : mysql-community-libs-compat-5.7.9-1.el7.x86_64                                                                                                                                                                            2/6
  Verifying  : mysql-community-libs-5.7.9-1.el7.x86_64                                                                                                                                                                                   3/6
  Verifying  : mysql-community-server-5.7.9-1.el7.x86_64                                                                                                                                                                                 4/6
  Verifying  : mysql-community-common-5.7.9-1.el7.x86_64                                                                                                                                                                                 5/6
  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                                                        6/6

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

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

Complete!
Enable MySQL Service using "service mysqld start"

Get the Temporary root password from /var/log/mysqld.log.

You can either change the Password using ALTER USER Or by Running Secure Installation option. i.e. mysql_secure_installation

[root@localhost mysql_binaries]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:
Error: Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost mysql_binaries]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
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) : n

 ... 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) : y
Success.

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!

You can Check the Installed Version By running the following

mysql> create database sriram;
Query OK, 1 row affected (0.00 sec)

mysql> use sriram;
Database changed
mysql> create table sriram_table (id int, name varchar(200));
Query OK, 0 rows affected (0.07 sec)

mysql> insert into sriram_table values(1,'Sriram');
Query OK, 1 row affected (0.02 sec)

mysql> insert into sriram_table values(2,'Sriram2');
Query OK, 1 row affected (0.03 sec)

mysql> insert into sriram_table values(3,'Sriram3');
Query OK, 1 row affected (0.02 sec)

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

mysql> select * from sriram_table;
+------+---------+
| id   | name    |
+------+---------+
|    1 | Sriram  |
|    2 | Sriram2 |
|    3 | Sriram3 |
+------+---------+
3 rows in set (0.00 sec)

You can run mysql_upgrade to see the information on update is needed .

mysql_upgrade saves the MySQL version number in a file named mysql_upgrade_info in the data directory. This is used to quickly check whether all tables have been checked for this release so that table-checking can be skipped.

In Our Next Post we See How to Upgrade this to the Latest Using RPM Upgrade Or Using YUM .

References :

https://dev.mysql.com/doc/refman/5.7/en/installing.html

https://dev.mysql.com/doc/refman/8.0/en/installing.html

Hope this is useful, Happy Reading.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.