How to Install MySQL 8 on CentOS 7 Linux

Hi Friends! We will learn about “How to install MySQL 8 on CentOS 7 Linux”, we will look at the installation for MySQL 8 step by step in CentOS 7 .

MySQL is the Relation Database, which is used to store the data. It Is open-source and widely used in the industries.

MySQL written in C and C++. It has also been tested to be a “fast, stable and true multi-user, multi-threaded SQL database server”.


First, we will download the MySQL 8 Community Edition installer for CentOS 7.

How to Install MySQL 8 on CentOS 7 Linux

So, after using that link you can select the Installer of your choice and will get the download link.

How to Install MySQL 8 on CentOS 7 Linux

Now right-click on “Download” and then select “Copy link address” and move to a terminal to download the bundle of MySQL 8.

So, now we will install wget in CentOS 7 to download the MySQL Packages.

# yum install wget

Let’s Find the Quick View to Install MySQL in Linux.

But after the QUICK view come and read the POST to get Detail knowledge about the installation of MySQL in Linux.

Click on Quick view to Install MySQL 8 on CentOS 7

1: Download the Package of MySQL Community Edition in CentOS 7

# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

2: Extract the Package of MySQL 8 on CentOS 8.

# tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

3: Install the Package of MySQL 8 using yum and rpm command on CentOS 8.

# yum install perl-Data-Dumper perl-JSON openssl-devel -y
# rpm -vih *.rpm

4: Start the service of MySQL 8 on CentOS 8.

# systemctl start mysqld
# systemctl enable mysqld

5: Configure MySQL with “mysql_secure_installation”.

# mysql_secure_installation

6: Logged in and Check the Database of MySQL in CentOS 8.

# mysql -h localhost -u[username] -p[password]

Install MySQL 8 on CentOS 7 Step by Step

STEP 1: Download the Package of MySQL Community Edition in CentOS 7

# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
How to Install MySQL 8 on CentOS 7 Linux
Download the tar file.

So, the file has been downloaded as “mysql-8.0.19.X.X.rpm-bundle.tar” and next, we have to extract the file using tar command.

STEP 2: Extract the Package of MySQL 8 on CentOS 8.

# tar -xvf  mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
How to Install MySQL 8 on CentOS 7 Linux
Extracted the Package for MySQL 8.

So, after extraction now lets install the packages using the rpm command.

STEP 3:Install the Package of MySQL 8 using rpm and yum command on CentOS 8.

So, before installing we got some dependencies error.

How to Install MySQL 8 on CentOS 7 Linux
Dependencies error

Let’s install the dependencies into CentOS 7

# yum install perl-Data-Dumper perl-JSON openssl-devel -y

And then use rpm command to install the MySQL 8 Package in CentOS 7.

How to Install MySQL 8 Linux
rpm command install
# rpm -vih *.rpm

STEP 4: Start the service of MySQL in CentOS 7.

# systemctl start mysqld

Start the service using systemctl command and if we want to start the service at the time of booting use below command.

# systemctl enable mysqld
STEP 5: Configure MySQL in CentOS 7.
Install MySQL 8 on CentOS
Starting the MySQL

So, after that check, the “mysqld.log” in /var/log/ folder, were you will get the temporary password.

# cat /var/log/mysqld.log
Install MySQL 8 CentOS
Password that to be used in mysql_secure_installation

We can see the logs very clearly the logs, let’s set our own password using “mysql_secure_installation”

# mysql_secure_installation
Install MySQL 8 in CentOS
mysql_secure_installation

So, you can “Enter a password of your choice” but there is some policy in MySQL for the password.

  1. The password length should be 8 or more than that.
  2. There should be one special character like “@#$!”
  3. There should be one UPPER case letter.
  4. Finally, there should be one LOWER case letter.
mysql_secure_installation

So then it will ask to remove the anonymous user press “y” to remove.

Next, it will prompt to Disallow root login remotely? means if we want to login from the root user remotely, press y|Y or press any other key to No.

mysql_secure_installation

So after that, it will ask to remove the test database and reload the changes and that’s Done.

STEP 6: Check the version of installed MySQL 8 on CentOS 7.

So we can check the version with two ways, by using the –version parameter with “mysql” command.

# mysql --version

Also, we can check the version by take login to the MySQL 8 server.

# mysql -h localhost -uUsername -pPassword
Login into Database

Let’s check the database after login, use “>show databases”

show databases

If you want to Install MySQL 8 on Ubuntu 20.04 then follow the link. If you want to check the POST to Install MySQL in Linux. Want to Install MySQL on Ubuntu 18.04. Install MySQL 8 in Rocky Linux.

Thanks for reading the POST. Keep sharing and supporting us!


Give your valuable time