Home Linux CentOS How to Install MySQL 8.0 Version on CentOS 7

How to Install MySQL 8.0 Version on CentOS 7

I want to install the latest MySQL 8.0 version on CentOS 7 server. How can I??

Install MySQL 8 Version on CentOS 7 Server
Install MySQL 8 Version on CentOS 7 Server

MySQL = ‘My’ is the name of the co-founder Michael Widenius’s daughter.
‘SQL’ is the abbreviation for the Structured Query Language.

MySQL is an open source RDMS (Relational database Management System). In this article, you will know step by step how to install the latest MySQL 8.0 version on CentOS 7 server.

For this follow these steps:

1. Add Repository for MySQL
2. Install MySQL 8.0 Version
3. Start MySQL Service
4. Secure Server
5. Connect with MySQL Server.

Step 1. Add Repository for MySQL

Here we are using official MySQL YUM repository. Download and add the MySQL YUM Repository to install MySQL 8.0 version.

CentOS 7:

# wget https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm

wget command downloads the MySQL Yum repository and now need to install this downloaded repository package.

# yum localinstall mysql80-community-release-el7-1.noarch.rpm

After installing the repository package, this will also add the MySQL YUM Repository to the Linux system. You can check the added newly repository.

# yum repolist enabled | grep "mysql"

Step 2. Install MySQL 8.0 Version

Run the following command to install the MySQL 8.0 version.

# yum install mysql-community-server
MySQL 8.0 Version Install
MySQL 8.0 Version Install

Above command will install the packages mysql-community-common, mysql-community-libs, mysql-community-client and mysql-community-server.

Step 3. Start MySQL Service

After successfull installation of MySQL 8.0, start the mysql service

# service mysqld start

To check the mysql service status:

# service mysqld status

You can also verify the installed mysql version by running following command.

# mysql --version

Step 4. Secure Server

As in MySQL 8.0 or later version creates the temporary password in the file /var/log/mysqld.log. Grep the password from this path before running the MySQL secure installation.

# grep 'temporary password' /var/log/mysqld.log

To secure MySQL need to run the mysql_secure_installation and this will allow us to set the root password, remove anonymous users etc.

# mysql_secure_installation

Need to enter the temporary password of mysql user root to start the mysql secure installation. And it will ask to change the password, set a new password as shown in below snapshot.

Change user root temporary password for mysql
Change user root temporary password for mysq

Now follow the step by step instructions and secure the sql server as done by the following steps:

  1. Remove anonymous users? Y
  2. Disallow root login? Y
  3. Remove test database and access to it? Y
  4. Reload the privilege tables now? Y

Sample output is shown below:

sql secure installation sample output
sql secure installation sample output

Step 5. Connect with MySQL Server

To connect MySQL server with user ‘root’, run this command.

# mysql -u root -p 

Read: remove mysql completely from centos 7.



Finally, you have installed MySQL 8.0 on CentOS 7 server and secured MySQL server.

LEAVE A REPLY

Please enter your comment!
Please enter your name here