Install MySQL 8.0.13 on CentOS 7.5 (1804)
Today I’m going to show you how to install MySQL 8.0.13 on CentOS 7.5 (1804).
This tutorial assumes that you are running a stock/default installation of CentOS 7.5, and have NOT previously installed MySQL or MariaDB.
1. Make sure you’re NOT already running MySQL/MariaDB
Run the following command:
mysql -v
Should output the following:
-bash: mysql: command not found
Perfect, let’s keep going!
2. Add the MySQL 8.0 Repository
Run the following command to add the MariaDB 10.3 repository to yum:
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
Should see some output similar to:
Retrieving https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
warning: /var/tmp/rpm-tmp.ETGjnt: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql80-community-release-el7-1 ################################# [100%]
Awesome, let’s move on!
3. Install MySQL 8.0 and verify success
Run the following command to install MySQL 8.0:
yum install mysql-community-server mysql-community-client
The output should look something like:
=============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Installing:
mysql-community-client x86_64 8.0.13-1.el7 mysql80-community 26 M
mysql-community-server x86_64 8.0.13-1.el7 mysql80-community 381 M
Installing for dependencies:
mysql-community-common x86_64 8.0.13-1.el7 mysql80-community 554 k
mysql-community-libs x86_64 8.0.13-1.el7 mysql80-community 2.3 M
net-tools x86_64 2.0-0.22.20131004git.el7 base 305 k
Transaction Summary
=============================================================================================================================================
Once yum does it’s thing, start the MySQL daemon:
systemctl start mysqld
Then verify that the service has started and the installation is complete:
mysql -v
You should see output similar to the following:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.13 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Awesome, type “quit” to exit, and let’s wrap this up by securing the installation!
4. Securing the Installation
Run the following command
mysql_secure_installation
Now answer the questions that you will be prompted for (the answers I’ve provided are generally what you want to do as well:
Enter current password for root (enter for none):
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Voila, that’s it! You’ll now be up and running with a secured installation of MySQL 8.0.13.