Databases

How To Install MySQL 8.4|8.0 on Fedora 43/42/41/40

MySQL is an open source relational database management system whose development is made possible by Oracle Corporation. The software is released under the GNU General Public License terms. In this guide, we will cover how to install MySQL 8.0 on Fedora 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.4 or 8.0 installed.

Original content from computingforgeeks.com - post 4471

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

One dependency for this setup is an installed and running instance of Fedora Linux distribution. See How to install Fedora on Physical Server / Virtual Environment

Add MySQL 8.x community repository

To install MySQL 8.x on Fedora, you need to add MySQL community repository.

Add MySQL 8 repository to Fedora:

Execute the following commands from the terminal to install MySQL repository.

### For Fedora 43, use the RHEL 9 repository ###
sudo dnf -y install https://dev.mysql.com/get/mysql84-community-release-el9-2.noarch.rpm

### Fedora 42 ###
sudo dnf -y install https://dev.mysql.com/get/mysql84-community-release-fc42-1.noarch.rpm

### Fedora 41 ###
sudo dnf -y install https://dev.mysql.com/get/mysql84-community-release-fc41-1.noarch.rpm

### Fedora 40 ###
sudo dnf -y install https://dev.mysql.com/get/mysql84-community-release-fc40-1.noarch.rpm

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

cat /etc/yum.repos.d/mysql-community.repo

For Fedora 43, edit the repo file and replace every instance of $releasever with 9. It should be as follows:

[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=https://repo.mysql.com/yum/mysql-connectors-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=https://repo.mysql.com/yum/mysql-8.0-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql-tools-community]
name=MySQL Tools Community
baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql-cluster-8.0-community]
name=MySQL Cluster 8.0 Community
baseurl=https://repo.mysql.com/yum/mysql-cluster-8.0-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=https://repo.mysql.com/yum/mysql-8.4-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023

[mysql-tools-8.4-lts-community]
name=MySQL Tools 8.4 LTS Community
baseurl=https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023

[mysql-cluster-8.4-lts-community]
name=MySQL Cluster 8.4 LTS Community
baseurl=https://repo.mysql.com/yum/mysql-cluster-8.4-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023

[mysql-innovation-community]
name=MySQL Innovation Release Community Server
baseurl=https://repo.mysql.com/yum/mysql-innovation-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql-tools-innovation-community]
name=MySQL Tools Innovation Community
baseurl=https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql-cluster-innovation-community]
name=MySQL Cluster Innovation Release Community
baseurl=https://repo.mysql.com/yum/mysql-cluster-innovation-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

Install MySQL Server 8.4 on Fedora

Add this line in your DNF config to avoid Fedora’s mysql8.4* for (Fedora 42 and 41):

sudo vim /etc/dnf/dnf.conf

Add:

[main]
exclude=mysql8.4*

Run the following commands to install MySQL Server 8.4 on Fedora:

sudo dnf install mysql-community-server

Press y to accept installation:

Updating and loading repositories:
 MySQL Tools Community                                                                                                                                                            100% |   6.8 KiB/s |  13.8 KiB |  00m02s
 MySQL 8.0 Community Server                                                                                                                                                       100% |  12.2 KiB/s |  27.6 KiB |  00m02s
 MySQL Connectors Community                                                                                                                                                       100% |  10.2 KiB/s |  23.2 KiB |  00m02s
Repositories loaded.
...
ransaction Summary:
 Installing:         6 packages

Total size of inbound packages is 59 MiB. Need to download 59 MiB.
After this operation, 337 MiB extra will be used (install 337 MiB, remove 0 B).
Is this ok [y/N]: y

Install MySQL Server 8.0 on Fedora

Once you have added the repository and confirm to be enabled, proceed as below:

Disable MySQL 8.4 repository

  • Fedora 43
$ sudo vim  /etc/yum.repos.d/mysql-community.repo
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=https://repo.mysql.com/yum/mysql-8.4-community/el/9/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
  • Fedora 41 & 42
$ sudo vim  /etc/yum.repos.d/mysql-community.repo
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.4-community/fc/$releasever/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
  • Fedora 40 and below
sudo dnf config-manager --disable mysql-8.4-lts-community

Enable MySQL 8.0 repository

  • Fedora 43:
& sudo vim  /etc/yum.repos.d/mysql-community.repo
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=https://repo.mysql.com/yum/mysql-8.0-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

[mysql-tools-community]
name=MySQL Tools Community
baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
  • Fedora 41 & 42:
$ sudo vim  /etc/yum.repos.d/mysql-community.repo
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/fc/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
  • Fedora 40 and below:
sudo dnf config-manager --enable mysql80-community

Install MySQL 8.0

Then. proceed to install MySQL 8.0 onto your Fedora by running:

sudo dnf install mysql-community-server

Proceed with the installation process of MySQL 8.0 on Fedora:

Updating and loading repositories:
 MySQL Connectors Community                                                                                                                                                       100% |   2.4 KiB/s |   3.0 KiB |  00m01s
 MySQL Tools 8.4 LTS Community                                                                                                                                                    100% |   5.6 KiB/s |   7.8 KiB |  00m01s
 MySQL 8.4 LTS Community Server                                                                                                                                                   100% |  12.3 KiB/s |  17.5 KiB |  00m01s
Repositories loaded.
...
Transaction Summary:
 Installing:         6 packages

Total size of inbound packages is 59 MiB. Need to download 59 MiB.
After this operation, 331 MiB extra will be used (install 331 MiB, remove 0 B).
Is this ok [y/N]: y

Also accept the importation of GPG keys when requested.

Running transaction
Importing OpenPGP key 0xA8D3785C:
 UserID     : "MySQL Release Engineering <[email protected]>"
 Fingerprint: BCA43417C3B485DD128EC6D4B7B3B788A8D3785C
 From       : file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
Is this ok [y/N]: y

After installation, the package info can be seen from:

rpm -qi mysql-community-server

Configure MySQL server on Fedora

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

1. Start and enable mysqld service:

sudo systemctl enable --now mysqld

2. Confirm that it’s running:

sudo systemctl status mysqld

Sample Output:

● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Fri 2025-12-19 22:52:24 EAT; 18s ago
 Invocation: 25adf64ef2b64940aca2b3fe456e5f94
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 1419 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 1491 (mysqld)
     Status: "Server is operational"
      Tasks: 35 (limit: 4631)
     Memory: 455.4M (peak: 470.4M)
        CPU: 3.187s
     CGroup: /system.slice/mysqld.service
             └─1491 /usr/sbin/mysqld

Dec 19 22:52:18 fedora-43.cloudlabske.local systemd[1]: Starting mysqld.service - MySQL Server...
Dec 19 22:52:23 fedora-43.cloudlabske.local (mysqld)[1491]: mysqld.service: Referenced but unset environment variable evaluates to an empty string: MYSQLD_OPTS
Dec 19 22:52:24 fedora-43.cloudlabske.local systemd[1]: Started mysqld.service - MySQL Server.

3. Copy the generated random password for the root user:

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

Take note the printed password:

A temporary password is generated for root@localhost: 1ph/axo>vJe;

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

$ sudo 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
Success.

Disallow root login remotely? : Yes
Success.

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

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

All done!

5. 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 21
Server version: 8.4.7 MySQL Community Server - GPL

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

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

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

mysql> SELECT version();
+-----------+
| version() |
+-----------+
| 8.4.7     |
+-----------+
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 "StrongP@ssw0rd";
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)

mysql> FLUSH PRIVILEGES;
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
Bye

Configure Firewall for remote connections

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="10.1.1.0/24" accept'

Thanks for installing MySQL 8.4 & 8.0 on Fedora with our guide. Until next time, stay tuned.

Other MySQL articles:

Related Articles

Databases How To Install ProxySQL on Amazon Linux 2023 Databases How to Set Up MariaDB Master-Slave Replication Databases Secure MySQL 8.4 LTS with TLS/SSL Certificates on Ubuntu 24.04 / Rocky Linux 10 Databases How To Install MariaDB 10.6 on Debian 12/11/10

Press ESC to close