In this article, we will show you how to install MySQL 8.0 on Fedora 31/32/33 versions step by step.
Step1:Download and add yum repository to your Fedora versions
Now download and add the following MySQL Yum repository to your respective Fedora versions repository list to install the latest version of MySQL 8.0
On Fedora 33
wget https://dev.mysql.com/get/mysql80-community-release-fc33-1.noarch.rpm
On Fedora 32
wget https://dev.mysql.com/get/mysql80-community-release-fc32-1.noarch.rpm
On Fedora 31
wget https://dev.mysql.com/get/mysql80-community-release-fc31-1.noarch.rpm
Add the downloaded package to repository:
After downloading the package for your Fedora version, install the package
On Fedora 33
sudo dnf localinstall mysql80-community-release-fc33-1.noarch.rpm
Then, type Y and press enter.
On Fedora 32
sudo dnf localinstall mysql80-community-release-fc32-1.noarch.rpm
On Fedora 31
sudo dnf localinstall mysql80-community-release-fc31-1.noarch.rpm
Following commands are common for all Fedora versions.
Step2: Install Latest version of MySQL on your Fedora
Below command installs all the needed packages for MySQL server mysql-community-server, mysql-community-client, mysql-community-common and mysql-community-libs.
sudo dnf install mysql-community-server
Type y and enter to continue.
Type y to import GPG key and enter to continue.
We have successfully installed MySQL 8.0.22(Latest version at the time of making article)
Now verify the MySQL version on Fedora using below command.
mysql -V
Step3: Start MySQL on Fedora
After successful installation, we have to start the MySQL on Fedora.
sudo systemctl start mysqld
Then, verify the MySQL status on Fedora using below command.
sudo systemctl status mysqld
Step 4: Securing the MySQL Installation
The script mysql_secure_installation allows us to secure your MySQL installation by performing important settings like root password, removing anonymous users, removing root login…
Type the command mysql_secure_installation and press enter. Then, we have to provide options.
Find Default Password, For security reasons, MySQL generates a temporary root key. Please note that MySQL has even stricter security policies than MariaDB.
sudo grep ‘temporary password’ /var/log/mysqld.log
mysql_secure_installation
Then, provide the temporary password.
Then provide new password,.
Then, answer the security questions as you prefer. or just say yes to all of them.
Step 5: Connect to MySQL on Fedora
mysql -u root -p