How to install MySQL on Fedora 31?

0
53

Fedora 31 is a great update to the previous version. It is a very used distribution although not as much as Ubuntu or Linux Mint. However, it is still a reference for its bold innovations. Well, many developers choose it to carry out their projects or to incursionar in the programming. So, learning to install MySQL on Fedora 31 becomes quite necessary for this purpose. So that’s what this article is all about.

As we already know since Oracle took over MySQL many Linux distributions, they took it out of their official repositories. This resulted in the incorporation of a fork called MariaDB. In terms of compatibility everything is guaranteed but it is true that many developers still prefer to use MySQL. So, you have to use another repository for it.

Install MySQL on Fedora 31

Oracle provides us with a repository to install MySQL. Specifically, version 8.0 is loaded with interesting new features. So, the first step is to open a terminal session and execute the following command to add the MySQL repository.

:~$ sudo dnf install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm
1.- Adding the MySQL repository to Fedora 31
1.- Adding the MySQL repository to Fedora 31

Then, once the repository is correctly added, we can install MySQL with the following command:

:~$ sudo dnf install mysql-community-server
2.- Installing MySQL on Fedora 31
2.- Installing MySQL on Fedora 31

And already, but before using it you have to make a few small configurations.

Using MySQL

MySQL is already installed, but you have to start the service to use it. So, run this command:

:~$ sudo systemctl start mysqld

If you want MySQL to start along with the system, use this other command as well:

:~$ sudo systemctl enable mysqld

For security reasons, MySQL generates a temporary root key. Please note that MySQL has even stricter security policies than MariaDB.

Then, you have to show which is the temporary password generated to be able to run the mysql_secure_installation script and be able to set a definite root key.

To do this, use the following command:

:~$ sudo cat /var/log/mysqld.log
3.- Configuring MySQL before the first use
3.- Configuring MySQL before the first use

In the image you can see, the generated key. Remember that in each case, it is different.

Then we can use the mysql_secure_installation script. In this script we will be able to set the definitive root password and make other security settings for the server.

:~$ sudo mysql_secure_installation

Enter the temporary key you previously obtained and you will immediately be able to establish yours.

MySQL has a plugin that does not allow weak passwords, so it establishes a strong one with numbers, signs and combinations of lower and uppercase letters.

Then, answer the security questions as you prefer. I said yes to all of them.

4.- using the mysql_secure_installation script
4.- using the mysql_secure_installation script

Now, you can use MySQL without problems. To do this, access the console with this command:

:~$ sudo mysql -u root -p
5.- using the mysql_secure_installation script
5.- using the mysql_secure_installation script

So, enjoy it.

Conclusion

MySQL continues to be the reference of the database relations handlers in Linux. However, as it is not present in the official repositories of Linux distributions, you have to take extra steps to install it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here