FedoraRHEL Based

How To Install MySQL on Fedora 39

Install MySQL on Fedora 39

In this tutorial, we will show you how to install MySQL on Fedora 39. MySQL, a versatile and powerful relational database management system, serves as the backbone for a myriad of applications, from small-scale projects to enterprise-level systems. Its installation on Fedora 39 via the Terminal streamlines the process, offering enhanced control and customization options.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MySQL database on a Fedora 39.


Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • You’ll need an active internet connection to download MySQL and its dependencies.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install MySQL on Fedora 39

Step 1. Start by updating the package list and repositories on your system to ensure you have access to the latest versions of software.

sudo dnf clean all
sudo dnf update

This command will fetch and install updates for all packages currently installed on your system. This ensures that your system is up-to-date with the latest security patches and bug fixes.

Step 2. Installing MySQL on Fedora 39.

To install MySQL, you can use the MySQL community edition or the official Fedora repository. For this guide, we’ll use the official Fedora repository. Install the MySQL server package with the following command:

sudo dnf install mysql-server

This command will prompt you to confirm the installation by typing ‘y‘ and then pressing ‘Enter.’ The package manager will download and install MySQL on your system.

Step 3. Secure Initial MySQL Configuration.

Upon successful installation, it’s vital to secure your MySQL installation by running the security script. This script will set the root password and configure some security settings:

sudo mysql_secure_installation

The script will ask you several questions, starting with setting the root password. Follow the prompts to complete the process. It’s highly recommended to set a strong password and answer ‘yes’ to the remaining security questions.

Step 4. Starting and Enabling MySQL Service.

After securing your MySQL installation, start the MySQL service and enable it to start automatically upon system boot:

sudo systemctl start mysqld
sudo systemctl enable mysqld

With MySQL up and running, it’s time to test the installation. Check the MySQL service status to confirm that it’s active and running:

sudo systemctl status mysqld

Additionally, you can verify the MySQL installation by logging in to the MySQL server using the root account:

sudo mysql -u root -p

You’ll be prompted to enter the root password you set during the security script. Once logged in, you’re in the MySQL shell, ready to start managing your databases.

Step 5. Configuring MySQL User and Database.

To create a new MySQL user and database, follow these steps:

sudo mysql -u root -p

Create a new database:

CREATE DATABASE your_database_name;

Create a new user and grant privileges:

CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL ON your_database_name.* TO 'your_username'@'localhost';

Step 6. Troubleshooting and Common Errors.

While installing MySQL, users may encounter certain issues. Here are a few common errors and their potential resolutions:

Error: Access Denied for User ‘root’@’localhost’

  • This can occur if the root password isn’t correctly set during installation. Re-run the secure installation process and ensure the password is accurately set.

Error: Can’t Connect to MySQL Server on ‘localhost’

  • Check if the MySQL service is running. Use sudo systemctl status mysqld to verify its status.

Congratulations! You have successfully installed MySQL. Thanks for using this tutorial for installing the MySQL database on your Fedora 39 system. For additional Apache or useful information, we recommend you check the official MySQL website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button