Step 1: Download and add the following MySQL Yum repository to install the latest version of MySQL.
Step 2: After downloading the package for Linux platform, now install the downloaded package with the following command.
yum localinstall mysql80-community-release-el8-1.noarch.rpm
Step 3: You can verify that the MySQL Yum repository has been added successfully by using the following command.
yum repolist enabled | grep "mysql.*-community.*"
Step 4: Install the latest version of MySQL (currently 8.0) using the following command.
yum install mysql-community-server
Step 5: After successful installation of MySQL, it’s time to start and enable the MySQL server with the following commands.
systemctl enable mysqld.service
systemctl start mysqld.service
systemctl status mysqld.service
Step 6: The command mysql_secure_installation allows you to secure your MySQL installation by performing important settings like setting the root password, removing anonymous users, removing root login, and so on.
Note: Use the below command to see the password before running MySQL secure command.
grep 'temporary password' /var/log/mysqld.log
Once you know the password you can now run the following command to secure your MySQL installation.
Note: Enter new Root password means your temporary password from a file
Step 7: Connect to a newly installed MySQL server by providing a username and password.
mysql -uroot -p
Step 8: Once the connection is working, execute the exit command to exit the mysql query window.
Step 9: Follow the steps in this link to set Sql mode