(Last Updated On: November 4, 2018)

In this guide, we will cover how to install MySQL 8.0 on  Fedora 29 / Fedora 28 Server or Workstation. If you have an old version of MySQL Server (e.g 5.7), you may need to do an in-place upgrade or dump all data, upgrade packages and re-import all database data to new MySQL 8.0 installed.

Our recent MySQL 8.0 installation guide was for Ubuntu: How to Install MySQL 8.0 on Ubuntu 18.04 / 16.04. The version of MySQL available via Fedora Modular repository is MySQL 5.7.

For a complete LAMP Stack on Fedora 29 / Fedora 28, check How to install LAMP Stack on Fedora 29 / Fedora 28

One dependency for this setup is an installed and running instance of Fedora 29 or Fedora 28 Linux distribution. See How to install Fedora 29 on Physical Server / VirtualBox & Vagrant

Step 1: Add MySQL 8.0 community repository

To install MySQL 8.0 on Fedora 29 / Fedora 28, you need to add MySQL 8.0 community repository:

For Fedora 29

Run the following command on your Fedora 29 terminal:

sudo dnf install https://repo.mysql.com//mysql80-community-release-fc29-1.noarch.rpm

Confirm repository installation by pressing y key when asked Is this ok [y/N]:

Last metadata expiration check: 1:49:36 ago on Sun 04 Nov 2018 07:57:27 AM UTC.
mysql80-community-release-fc29-1.noarch.rpm                                                                            15 kB/s |  29 kB     00:01    
Dependencies resolved.
 Package                                         Arch                         Version                        Repository                          Size
 mysql80-community-release                       noarch                       fc29-1                         @commandline                        29 k

Transaction Summary
Install  1 Package

Total size: 29 k
Installed size: 29 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
Installed: mysql80-community-release-fc29-1.noarch
  Installing       : mysql80-community-release-fc29-1.noarch                                                                                      1/1 
Installed: mysql80-community-release-fc29-1.noarch
  Verifying        : mysql80-community-release-fc29-1.noarch                                                                                      1/1 



For Fedora 28

If you’re on Fedora 28, use:

sudo dnf install https://repo.mysql.com//mysql80-community-release-fc28-1.noarch.rpm

This will write a repository file to /etc/yum.repos.d/mysql-community.repo

Step 2: Install MySQL Server 8.0

Once you have added the repository and confirm to be enabled, proceed to install MySQL 8.0 onto your Fedora 29 / Fedora 28 by running:

sudo dnf -y install mysql-community-server

After installation, the package info can be seen from:

$ dnf info mysql-community-server
Last metadata expiration check: 0:40:41 ago on Sun 04 Nov 2018 09:55:41 AM UTC.
Installed Packages
Name         : mysql-community-server
Version      : 8.0.13
Release      : 1.fc29
Arch         : x86_64
Size         : 1.8 G
Source       : mysql-community-8.0.13-1.fc29.src.rpm
Repo         : @System
From repo    : mysql80-community
Summary      : A very fast and reliable SQL database server
URL          : http://www.mysql.com/
License      : Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.
Description  : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
             : and robust SQL (Structured Query Language) database server. MySQL Server
             : is intended for mission-critical, heavy-load production systems as well
             : as for embedding into mass-deployed software. MySQL is a trademark of
             : Oracle and/or its affiliates
             : The MySQL software has Dual Licensing, which means you can use the MySQL
             : software free of charge under the GNU General Public License
             : (http://www.gnu.org/licenses/). You can also purchase commercial MySQL
             : licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
             : the GPL. See the chapter "Licensing and Support" in the manual for
             : further info.
             : The MySQL web site (http://www.mysql.com/) provides the latest news and
             : information about the MySQL software.  Also please see the documentation
             : and the manual for more information.
             : This package includes the MySQL server binary as well as related utilities
             : to run and administer a MySQL server.

Step 3: Configure the MySQL server

After installation of MySQL 8.0 on Fedora 29 / Fedora 28, you need to do initial configuration to secure it.

1. Start and enable mysqld service

sudo systemctl start mysqld.service 
sudo systemctl enable mysqld.service

2. Copy the generated random password for the root user

grep 'A temporary password' /var/log/mysqld.log |tail -1

Take note the printed password:

A temporary password is generated for [email protected]: 1ph/axo>vJe;

3. Start MySQL Secure Installation to change the root password, Disallow root login remotely, remove anonymous users and remove test database.

$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:

Authenticate with your generated temporary password. Then configure your MySQL 8.0 installation like below:

Change the password for root ? ((Press y|Y for Yes, any other key for No) : Yes

New password: 
Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?: Yes

Remove anonymous users?: Yes

Disallow root login remotely? : Yes

Remove test database and access to it? : Yes
 - Dropping test database...
 - Removing privileges on test database...

Reload privilege tables now? (Press y|Y for Yes) : Yes

All done! 

4. Connect to MySQL Database as root user and create a test database

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.13 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT version();
| version() |
| 8.0.13    |
1 row in set (0.00 sec)

Create a test database and user

mysql> CREATE DATABASE test_db;
Query OK, 1 row affected (0.09 sec)

mysql> CREATE USER 'test_user'@'localhost' IDENTIFIED BY "Strong34S;#";
Query OK, 0 rows affected (0.04 sec)

mysql> GRANT ALL PRIVILEGES ON test_db.* TO 'test_user'@'localhost';
Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

This test database and user can be dropped by running:

mysql> DROP DATABASE test_db;
Query OK, 0 rows affected (0.14 sec)

mysql> DROP USER 'test_user'@'localhost';
Query OK, 0 rows affected (0.11 sec)

mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
4 rows in set (0.01 sec)

mysql> QUIT

Step 4: Configure Firewall

To allow for remote connections, allow port 3306 on the firewall

sudo firewall-cmd --add-service=mysql --permanent 
sudo firewall-cmd --reload

You can also limit access from trusted networks

sudo firewall-cmd --permanent --add-rich-rule 'rule family="ipv4" \
service name="mysql" source address="" accept'

Thanks for installing MySQL 8.0 on Fedora 29 / Fedora 28 with our guide. Until next time, stay tuned.