How to install MySQL on Fedora Linux?

MySQL is a free and open-source relational database management system. A relational database organizes data into one or more tables in which data types may be related to each other.

SQL (Structured Query Language) is used to create, modify and extract data from a relational database, and also control the user access to the database.

As I already discussed how to install MySQL on Ubuntu.

Today in this article I will discuss how to install MySQL in Fedora Linux.


To complete this installation guide you will need to have the following.

  • A system running a recent version of Fedora Linux
  • Access to a user account with superuser privileges

How to install MySQL on Fedora

The latest stable version of MySQL is available in the default Fedora repository. You can follow the given steps to install it on your system.

Before you install a package to your system make sure packages on your system are updated –

sudo dnf update -y

Now use the given command to install the MySQL server on your Fedora system –

sudo dnf install @mysql

Press y and then enter if it asks for your confirmation.

This will install MySQL on your system with all required dependencies.

Once installation is completed you can verify it by using –

mysql --version

This will display the installed version –

mysql version

Start and enable MySQL services

By default, MySQL services are not running you can use the following command to start it –

sudo systemctl start mysqld

Enable it to automatically start on boot by running the given command –

sudo systemctl enable mysqld

Check the status of MySQL service on Fedora

After starting and enabling MySQL services in your system. You can check if MySQL services are running or not by using the given command.

systemctl status mysqld

If MySQL services are running on your system you will see –

mysqld status

Securing MySQL database

Run the mysql_secure_installation to secure MySQL on your system. This is a security script that makes some less secure default options more secure for example the Validate Password Component is used to test the strength of the MySql password, you can disallow remote root login if you want.

Use the given command to run this script in the Fedora terminal –

sudo mysql_secure_installation

This will prompt you to choose the options if you want to allow the option press y and enter for yes otherwise type n and then press enter for no. Meanwhile, you will be asked to set the MySql root user password. Choose the strength 0 for low 1 for medium 3 for strong password and then enter the password for root. If everything gets completed you will see the All done! message.

Start using MySql 

To start MySQL on your system use the following command in your terminal –

sudo mysql -u root -p

This will ask you to enter your MySQL root user password, enter to proceed.

Once authentication gets completed, your prompt will be changed to MySQL shell.


Now you can start executing MySQL commands here.


You have successfully installed MySQL on your Fedora system. Now if you have any a query or feedback then write us in the comments below.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.