How To Install MariaDB on Fedora 39
In this tutorial, we will show you how to install MariaDB on Fedora 39. In the realm of open-source relational database management systems, MariaDB stands tall as a popular choice, known for its performance, security, and robust features. If you’re a Fedora 39 user looking to harness the power of MariaDB, you’ve come to the right place.
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 MariaDB database on a Fedora 39.
Prerequisites
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.
- You will need access to the terminal to execute commands. Fedora 39 provides the Terminal application for this purpose. It can be found in your Applications menu.
- You’ll need an active internet connection to download MariaDB and its dependencies.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install MariaDB on Fedora 39
Step 1. Before installing any software on your system, it’s important to ensure your package repository is up-to-date. Use the following command:
sudo dnf clean all sudo dnf update
This command will refresh the repository and ensure that you have the latest software available.
Step 2. Installing MariaDB on Fedora 38.
Once the repository is updated, you can proceed to install MariaDB using the Dandified Yum (dnf
) package manager:
sudo dnf install mariadb-server
This command will download and install MariaDB and its dependencies on your Fedora 39 system.
To ensure MariaDB starts on boot and to initiate it immediately, run the following commands:
sudo systemctl start mariadb sudo systemctl enable mariadb
This will start the MariaDB service and enable it to start automatically when your system boots.
Step 3. Securing the MariaDB Installation.
Securing the installation is crucial for safeguarding your database. Run the security script:
sudo mysql_secure_installation
The script will guide you through securing your installation by setting a root password, removing anonymous users, disallowing remote root login, and removing the test database.
Step 4. Basic MariaDB Operations.
With MariaDB successfully installed and secured, let’s explore some essential operations.
To access the MariaDB shell as the root user, run the following command:
sudo mysql -u root -p
You’ll be prompted to enter the root password you set during the secure installation step.
Let’s create a new database and a user with the necessary privileges. Replace yourdatabase
, youruser
, and yourpassword
with your preferred choices:
CREATE DATABASE yourdatabase; CREATE USER 'youruser'@'localhost' IDENTIFIED BY 'your-strong-password'; GRANT ALL PRIVILEGES ON yourdatabase.* TO 'youruser'@'localhost'; FLUSH PRIVILEGES;
This SQL code will create a new database, a user with the specified password, grant them all privileges on the database, and then flush the privileges to apply the changes.
Step 5. Advanced Configurations (Optional).
Fine-tuning MariaDB configurations enhances performance. Edit the configuration file as follows:
sudo nano /etc/my.cnf.d/server.cnf
Enable remote access by modifying the bind-address:
bind-address = 0.0.0.0
Step 6. Troubleshooting and Common Issues.
-
Failed to Start MariaDB: If MariaDB fails to start, check the error message using
sudo systemctl status mariadb
. This will provide clues to the issue, which could range from configuration errors to conflicts with other services. Ensure your configurations are correct and that there are no port conflicts. - Access Denied for User ‘root’@’localhost’: If you encounter an “Access denied” error while trying to log in, ensure you are using the correct root password. If you’ve forgotten the password, you can reset it by following the steps for resetting the root password in MariaDB documentation.
- Database Connection Errors: When connecting to the database from your application, make sure you’re using the correct hostname, username, and password. Also, check if your firewall or SELinux settings are blocking the connection.
Congratulations! You have successfully installed MariaDB. Thanks for using this tutorial for installing the MariaDB database on your Fedora 39 system. For additional Apache or useful information, we recommend you check the official MariaDB website.