Install MySQL 8.0 on CentOS8

CentOS,MySQLCentOS,MySQL

Install MySQL Yum Repository

Example: Download “mysql80-community-release-el8-1.noarch.rpm

wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm

Install “mysql80-community-release-el8-1.noarch.rpm

yum install mysql80-community-release-el8-1.noarch.rpm

Add “sudo", if needed.

Check Repo list

# yum repolist all | grep mysql
mysql-cluster-8.0-community        MySQL Cluster 8.0 Community          disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - Source disabled
mysql-connectors-community         MySQL Connectors Community           enabled
mysql-connectors-community-source  MySQL Connectors Community - Source  disabled
mysql-tools-community              MySQL Tools Community                enabled
mysql-tools-community-source       MySQL Tools Community - Source       disabled
mysql-tools-preview                MySQL Tools Preview                  disabled
mysql-tools-preview-source         MySQL Tools Preview - Source         disabled
mysql80-community                  MySQL 8.0 Community Server           enabled
mysql80-community-source           MySQL 8.0 Community Server - Source  disabled


If a default MySQL is included in OS, Disable it.

yum module disable mysql

It is important. Otherwise, you may encounter the following error when you install MySQL.

yum install mysql-community-server
MySQL 8.0 Community Server                                    2.5 MB/s | 1.1 MB     00:00
MySQL Connectors Community                                    262 kB/s |  43 kB     00:00
MySQL Tools Community                                         753 kB/s | 147 kB     00:00
All matches were filtered out by modular filtering for argument: mysql-community-server
Error: Unable to find a match: mysql-community-server


Install MySQL Community Server

yum install mysql-community-server


Start MySQL

systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
systemctl start mysqld


Change root password

Get temporary root password from a mysqld.log

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

Login MySQL and change root password.

mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassw0rd@';