MySQL is an open-source relational database management system that is widely used for storing and organizing data in a structured manner. Fedora is a popular Linux distribution that is widely used by developers and system administrators. I
If you need to install MySQL 5.7, the official repository provides packages up to Fedora 31. The latest Fedora version is recommended to use MySQL 8.0. Use other article to install MySQL 5.7 on Fedora 31/30 and earlier versions.
In this article, we will be discussing how to install MySQL 8.0 on Fedora.
Login to your Fedora system and open a terminal. Now upgrade the current packages to the latest version by running the following command.
sudo dnf update
Step 1: Setup Yum Repository
The MySQL team officially provides a yum repository for the installation of the MySQL community server on Fedora systems. Create a new yum repository file using the content below:
sudo nano /etc/yum.repos.d/mysql-community.repo
Add the below content to the file:
Save the file and close.
Step 2: Install MySQL on Fedora
Now, run the following command to install the
mysql-community-server packages on your Fedora system. This will also install all other required dependencies on your system.
sudo dnf install mysql-community-server
This will install the latest packages of MySQL 8 on fedora systems.
Once the installation is completed successfully, you need to enable and start the MySQL service.
sudo systemctl enable mysqld.service
sudo systemctl start mysqld.service
Now, follow the post-installation instructions.
Step 3: Securing MySQL
The MySQL community server has been installed on your system. The installer will also generate a random password and set it for the root user. You can find the root user password in the log files.
grep 'A temporary password is generated' /var/log/mysqld.log | tail -12018-10-16T11:49:31.216147Z 1 [Note] A temporary password is generated for root@localhost: 4fyJrusM58kW7
Now run the following command to apply security on the MySQL server. Simply execute the below command and follow the security wizard.
Follow the onscreen instructions. Change your root account password and Press Y for all other operations to apply improved security.
- Change the password for root? – Press y and change root password
- Remove anonymous users? Press y
- Disallow root login remotely? Press y
- Remove test database and access to it? (Press y
- Reload privilege tables now? Press y
Step 4: Connect MySQL Terminal
All done. You can now connect to the MySQL server using the command line. The following command will connect MySQL running on the localhost as the root user. This will prompt for the root account password. You can also install LAMP stack on Fedora and configure PHPMyAdmin on fedora to access databases graphically.
mysql -u root -p
Now, you can create a database for your applications to store data.
In conclusion, installing MySQL 8.0 on Fedora is a straightforward process that can be completed in a few simple steps. By following this guide, you will have a working installation of MySQL 8.0 on your Fedora system.