# MySQL installation on Linux (RPM)

In 
Published 2022-12-03

This tutorial shows you how to install MySQL on Linux 6 (RHEL6/CentOS6) and Oracle Linux 7 (RHEL7/CentOS7) when is no Internet connection. This article has a step-by-step approach and will present you how to install MySQL 5.7 database on Linux 6 (RHEL6/CentOS6).

When you want to install MySQL Server on Linux, the first thing is to download the RPM package (repository package). From dev.mysql.com click on "Looking for previous GA versions?" and select the platform (Red Hat Enterprise Linux/ Oracle LiRed Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 64-bit), RPM Bundlenux) and a version (this is 5.6.35 in my case). I will choose to download the "Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package". This will download the "MySQL-5.6.35-1.el6.x86_64.rpm-bundle.tar" file.

I will put this file in a "stage" repository:

Uncompress the .tar file:

# tar -xvf mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar

... and you will see in the stage "directory" all the RPMs you need:

Now, you can start the MySQL database Server:

[root@idam mysql]# service mysqld start
Initializing MySQL database: [ OK ]
Installing validate password plugin: [ OK ]
Starting mysqld: [ OK ]

However, if you have an ERROR (when MySQL is starting), you have to

  • uninstall the MySQL Server : yum remove mysql mysql-server
  • run mv /var/lib/mysql /var/lib/mysql_old
  • install again MySQL Server : yum install mysql mysql-server

You can set the MySQL server to start the service on reboot:

chkconfig mysqld on

Make sure SELinux is running in permissive mode, so you can change the locations of the MySQL files:

setenforce Permissive

and set "SELINUX=permissive" in the "/etc/selinux/config" file (to be permanent).

Now your MySQL database v. 5.7 is installed on Linux6 and ready to be used.