Step 1 — Installing MySQL
In a web browser, visit:
Locate the desired version, and update it as needed in the link below:
Once the rpm file is saved, we will verify the integrity of the download by running md5sum and comparing it with the corresponding MD5 value listed on the site:
we’ll install the package:
sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
This adds two new MySQL yum repositories, and we can now use them to install MySQL server:
sudo yum install mysql-server
y to confirm that you want to proceed. Since we’ve just added the package, we’ll also be prompted to accept its GPG key. Press
y to download it and complete the install.
Step 2 — Starting MySQL
We’ll start the daemon with the following command:
sudo systemctl start mysqld
systemctl doesn’t display the outcome of all service management commands, so to be sure we succeeded, we’ll use the following command:
sudo systemctl status mysqld
If MySQL has successfully started, the output should contain
Active: active (running) and the final line should look something like:
Note: MySQL is automatically enabled to start at boot when it is installed.
During the installation process, a temporary password is generated for the MySQL root user. Locate it in the
mysqld.log with this command:
sudo grep 'temporary password' /var/log/mysqld.log
Step 3 — Configuring MySQL
MySQL includes a security script to change some of the less secure default options for things like remote root logins and sample users.
Use this command to run the security script.
This will prompt you for the default root password. As soon as you enter it, you will be required to change it.