Votes: 0Posted On: Oct 05, 2017 03:00:19
I can understand your confusion as in CentOS 7 the MariaDB is installed when you type in the command "yum install mysql". MariaDB is a fork of MySQL and works really well with CentOS 7. Hence, if you want to install MySQL, you will have to download the files directly from the site. However, it is recommended that you use MariaDB until you have a specific task from MySQL.
The following steps will guide you towards the installation of MySQL on CentOS 7.
(Note: Uninstall MariaDB from the system as it can interfere with the installation.)
1. CentOS 7 operating system
2. User with sudo privileges
Getting the MySQL package
To get the MySQL package, you will first have to view the name of the package from the MySQL yum repository web page.
Here is a sample output for the following.
Here we will select "Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package" package. Just copy the package name given in brackets and include in the following command. This command will save the file in your system.
Installing the MySQL package
You can check the package integrity by running the following command and comparing its value with the value on the web page.
Now that we have downloaded and verified the package, we will install it by running the following commands.
sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm
sudo yum install mysql-server
Starting MySQL services
The MySQL services can be started with the help of the following command.
sudo systemctl start mysqld
To check if the service is started, you can check its status by running the following command.
sudo systemctl status mysqld
Once you have installed and started the MySQL service, you can configure it as per your liking.