MySQL is a relational database management system. This tutorial will help you to install MySQL 5.7 on Fedora systems.
You can also follow these instructions to install MySQL 8 on your Fedora system.
Step 1 – Prerequsiteis
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 2 – Configure Yum Repository
The MySQL team provides Yum repository for the installation of MySQL community server on Fedora systems. Let’s create a repository file as:
[mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/fc/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Save file and close.
Step 3 – Install MySQL Server
After that run the following command to install the mysql-community-server package on your systems. This will also install all other required dependencies.
sudo dnf install mysql-community-server
After the installation of MySQL server on Fedora system. Enable the MySQL service to start on system boot. Also, start service using the below commands:
sudo systemctl enable mysqld.service sudo systemctl start mysqld.service
Okay, now follow the post-installation instructions.
Step 4 – MySQL Post Installation Setup
The MySQL community server has been installed on your system. The installer will also generate a random password and set for the root user. You can find root user password in log files.
grep 'A temporary password is generated' /var/log/mysqld.log | tail -1 2018-10-16T11:49:31.216147Z 1 [Note] A temporary password is generated for [email protected]: ,yJrusM58kW7
Now run the following command to apply security on MySQL server. Simply execute 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 5 – 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 localhost as the root user. This will prompt for root account password. You can also install LAMP stack on Fedora and configure PHPMyAdmin on fedora to access databases graphically.
mysql -u root -p