In this tutorial, we will show you how to install MySQL on Fedora 37. For those of you who didn’t know, MySQL is a popular and widely-used open-source relational database management system (RDBMS) that is used by many web-based applications to store and manage data. Its robust feature set and flexibility make it an ideal choice for a variety of different use cases, from small-scale projects to enterprise-level applications.
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 37.
Prerequisites
- A server running one of the following operating systems: Fedora 37.
- 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).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for MySQL.
- 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 MySQL on Fedora 37
Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:
sudo dnf upgrade sudo dnf update
Step 2. Installing MySQL on Fedora 37.
By default, the MySQL package doesn’t come in the default repository of Fedora 37. Now run the following command below to add MySQL repository to your Fedora system:
sudo dnf install https://dev.mysql.com/get/mysql80-community-release-fc37-1.noarch.rpm
After adding the MySQL Yum repository, you can install MySQL on your Fedora 37 system by running the following command below:
sudo dnf install mysql-community-server
Once the installation is complete, start the MySQL service by running the following command:
sudo systemctl start mysqld sudo systemctl enable mysqld
To verify that MySQL is installed, run the following command:
mysql --version
Step 3. Secure the MySQL Installation.
MySQL comes with a script that can help you to secure the installation. To run this script, type the following command:
sudo mysql_secure_installation
This command will start the MySQL secure installation wizard, which will guide you through the process of securing the MySQL server. You will be prompted to set a root password, remove anonymous users, disable remote root login, and remove the test database. Follow the prompts to complete the setup.
Output:
Securing the MySQL server deployment. Enter password for user root: The existing password for the user account root has expired. Please set a new password. New password: Re-enter new password: The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : y New password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
Congratulations! You have successfully installed MySQL. Thanks for using this tutorial for installing the MySQL database on your Fedora 37 system. For additional help or useful information, we recommend you check the official MySQL website.